Projekt

2025-01-29

Wstęp

Opis problemu

Problemem, który analizujemy w niniejszym projekcie jest wpływ poszczególnych czynników na wynik końcowy ucznia (?)

Baza danych

Baza danych którą analizujemy nazywa się „Wyniki uczniów”. Znajduje się w niej 20 kolumn z danymi oraz 6.608 wierszy danych. W bazie danych znajdują się zarówno zmienne liczbowe jak i jakościowe.

czynniki <- read.csv("czynniki.csv")
glimpse(czynniki)
## Rows: 6,607
## Columns: 20
## $ Hours_Studied              <int> 23, 19, 24, 29, 19, 19, 29, 25, 17, 23, 17,…
## $ Attendance                 <int> 84, 64, 98, 89, 92, 88, 84, 78, 94, 98, 80,…
## $ Parental_Involvement       <chr> "Low", "Low", "Medium", "Low", "Medium", "M…
## $ Access_to_Resources        <chr> "High", "Medium", "Medium", "Medium", "Medi…
## $ Extracurricular_Activities <chr> "No", "No", "Yes", "Yes", "Yes", "Yes", "Ye…
## $ Sleep_Hours                <int> 7, 8, 7, 8, 6, 8, NA, 6, 6, 8, 8, 6, 8, 8, …
## $ Previous_Scores            <int> 73, 59, 91, 98, 65, 89, 68, 50, 80, 71, 88,…
## $ Motivation_Level           <chr> "Low", "Low", "Medium", "Medium", "Medium",…
## $ Internet_Access            <chr> "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "…
## $ Tutoring_Sessions          <int> 0, 2, 2, 1, 3, 3, 1, 1, 0, 0, 4, 2, 2, 2, 1…
## $ Family_Income              <chr> "Low", "Medium", "Medium", "Medium", "Mediu…
## $ Teacher_Quality            <chr> "Medium", "Medium", "Medium", "Medium", "Hi…
## $ School_Type                <chr> "Public", "Public", "Public", "Public", "Pu…
## $ Peer_Influence             <chr> "Positive", "Negative", "Neutral", "Negativ…
## $ Physical_Activity          <int> 3, 4, 4, 4, 4, 3, 2, 2, 1, 5, 4, 2, 4, 3, 4…
## $ Learning_Disabilities      <chr> "No", "No", "No", "No", "No", "No", "No", "…
## $ Parental_Education_Level   <chr> "High School", "College", "Postgraduate", "…
## $ Distance_from_Home         <chr> "Near", "Moderate", "Near", "Moderate", "Ne…
## $ Gender                     <chr> "Male", "Female", "Male", "Male", "Female",…
## $ Exam_Score                 <int> 67, 61, 74, 71, NA, 71, 67, 66, 69, 72, 68,…

Czyszczenie danych

W niniejszym rozdziale sprawdzimy jakość danych, zbadamy występowanie braków danych oraz dobierzemy odpowiednią metodę imputacji brakujących danych (jeżeli zajdzie taka potrzeba).

Walidacja danych

Zostało wykonane badanie danych za pomocą funkcji aggr. Wykres po lewej stronie prezentuje proporcje braków danych. W naszym przypadku największe braki występują w trzech zmiennych:

  • Sleep Hours - 5,22%
  • Exam Score - 4,37%
  • Distance from Home - 1,01%

Tabela po prawej stronie ilistruje współwystępowanie braków w zestawie danych. Czerwone pola oznaczają brakujące wartości. Można zauważyć, że brakujące dane są dość rozporoszone i nie występują jednocześnie w wielu zmiennych. Oznacza to, że nie instnieje współzależność pomiędzy występowaniem braków więc dane brakujące będziemy uzupełniać za pomocą podobieństwa.

aggr(czynniki, numbers = TRUE, sortVars = TRUE)

## 
##  Variables sorted by number of missings: 
##                    Variable      Count
##                 Sleep_Hours 0.05297412
##               Family_Income 0.05297412
##                  Exam_Score 0.04540639
##    Parental_Education_Level 0.01362192
##             Teacher_Quality 0.01180566
##          Distance_from_Home 0.01014076
##               Hours_Studied 0.00000000
##                  Attendance 0.00000000
##        Parental_Involvement 0.00000000
##         Access_to_Resources 0.00000000
##  Extracurricular_Activities 0.00000000
##             Previous_Scores 0.00000000
##            Motivation_Level 0.00000000
##             Internet_Access 0.00000000
##           Tutoring_Sessions 0.00000000
##                 School_Type 0.00000000
##              Peer_Influence 0.00000000
##           Physical_Activity 0.00000000
##       Learning_Disabilities 0.00000000
##                      Gender 0.00000000
gg_miss_upset(czynniki)

Wykres poniżej został stworzony za pomocą funkcji gg_miss_upset. Prezentuje on wartości liczbowe brakujących danych

  • Family income – 309
  • Sleep Hours – 300

Z uwagi na stosunkowo wysoką ilość braków dokonamy imputacji danych.

czynniki1<- czynniki[!is.na(czynniki$Family_Income), ]
czynniki2<- czynniki1[!is.na(czynniki1$Parental_Education_Level), ]
czynniki3<- czynniki2[!is.na(czynniki2$Teacher_Quality), ]
czynniki4<- czynniki3[!is.na(czynniki3$Distance_from_Home), ]
unique(czynniki4$Family_Income)
## [1] "Low"    "Medium" "High"
unique(czynniki4$Parental_Education_Level)
## [1] "High School"  "College"      "Postgraduate"
unique(czynniki4$Teacher_Quality)
## [1] "Medium" "High"   "Low"
unique(czynniki4$Distance_from_Home)
## [1] "Near"     "Moderate" "Far"
glimpse(czynniki4)
## Rows: 6,038
## Columns: 20
## $ Hours_Studied              <int> 23, 19, 24, 29, 19, 19, 29, 25, 17, 17, 17,…
## $ Attendance                 <int> 84, 64, 98, 89, 92, 88, 84, 78, 94, 80, 97,…
## $ Parental_Involvement       <chr> "Low", "Low", "Medium", "Low", "Medium", "M…
## $ Access_to_Resources        <chr> "High", "Medium", "Medium", "Medium", "Medi…
## $ Extracurricular_Activities <chr> "No", "No", "Yes", "Yes", "Yes", "Yes", "Ye…
## $ Sleep_Hours                <int> 7, 8, 7, 8, 6, 8, NA, 6, 6, 8, 6, 8, 8, NA,…
## $ Previous_Scores            <int> 73, 59, 91, 98, 65, 89, 68, 50, 80, 88, 87,…
## $ Motivation_Level           <chr> "Low", "Low", "Medium", "Medium", "Medium",…
## $ Internet_Access            <chr> "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "…
## $ Tutoring_Sessions          <int> 0, 2, 2, 1, 3, 3, 1, 1, 0, 4, 2, 2, 2, 1, 2…
## $ Family_Income              <chr> "Low", "Medium", "Medium", "Medium", "Mediu…
## $ Teacher_Quality            <chr> "Medium", "Medium", "Medium", "Medium", "Hi…
## $ School_Type                <chr> "Public", "Public", "Public", "Public", "Pu…
## $ Peer_Influence             <chr> "Positive", "Negative", "Neutral", "Negativ…
## $ Physical_Activity          <int> 3, 4, 4, 4, 4, 3, 2, 2, 1, 4, 2, 4, 3, 4, 4…
## $ Learning_Disabilities      <chr> "No", "No", "No", "No", "No", "No", "No", "…
## $ Parental_Education_Level   <chr> "High School", "College", "Postgraduate", "…
## $ Distance_from_Home         <chr> "Near", "Moderate", "Near", "Moderate", "Ne…
## $ Gender                     <chr> "Male", "Female", "Male", "Male", "Female",…
## $ Exam_Score                 <int> 67, 61, 74, 71, NA, 71, 67, 66, 69, 68, 71,…
gg_miss_upset(czynniki4)

aggr(czynniki4, numbers = TRUE, sortVars = TRUE)

## 
##  Variables sorted by number of missings: 
##                    Variable      Count
##                 Sleep_Hours 0.05266645
##                  Exam_Score 0.04372309
##               Hours_Studied 0.00000000
##                  Attendance 0.00000000
##        Parental_Involvement 0.00000000
##         Access_to_Resources 0.00000000
##  Extracurricular_Activities 0.00000000
##             Previous_Scores 0.00000000
##            Motivation_Level 0.00000000
##             Internet_Access 0.00000000
##           Tutoring_Sessions 0.00000000
##               Family_Income 0.00000000
##             Teacher_Quality 0.00000000
##                 School_Type 0.00000000
##              Peer_Influence 0.00000000
##           Physical_Activity 0.00000000
##       Learning_Disabilities 0.00000000
##    Parental_Education_Level 0.00000000
##          Distance_from_Home 0.00000000
##                      Gender 0.00000000

Imputacja danych

as.numeric(czynniki4$Exam_Score)
##    [1]  67  61  74  71  NA  71  67  66  69  68  71  70  66  65  64  60  65  67
##   [19]  66  69  72  66  66  63  65  71  66  64  69  67  68  61  64  67  63  NA
##   [37]  67  65  64  70  68  65  68  64  68  63  64  67  67  66  72  65  71  66
##   [55]  68  70  62  68  71  68  69  NA  69  65  70  71  65  72  69  66  68  65
##   [73]  60  65  66  74  62  70  69  67  64  71  68  64  63  71  69 100  68  62
##   [91]  68  66  64  67  65  65  69  63  72  76  69  67  69  63  67  66  79  64
##  [109]  73  63  65  73  70  68  71  64  68  69  NA  67  68  64  66  63  66  66
##  [127]  67  65  68  68  65  71  65  64  72  65  66  61  68  69  71  70  68  67
##  [145]  68  68  72  65  66  65  67  NA  69  66  69  67  66  71  70  71  66  67
##  [163]  66  72  68  69  71  70  67  69  65  65  64  63  69  64  72  63  64  64
##  [181]  67  71  70  61  67  72  66  70  67  67  71  66  68  74  64  65  66  66
##  [199]  68  78  67  74  74  62  66  69  68  89  66  68  67  75  60  66  73  68
##  [217]  62  62  65  69  64  67  70  70  69  61  69  63  67  66  63  68  65  67
##  [235]  68  64  71  69  67  65  68  67  67  66  70  65  69  65  63  67  61  65
##  [253]  66  66  69  63  65  67  69  65  65  65  67  72  NA  65  69  68  64  59
##  [271]  68  60  62  67  68  64  65  65  63  70  66  66  63  66  65  NA  67  66
##  [289]  63  NA  67  71  67  69  67  72  70  67  64  67  69  63  68  70  66  68
##  [307]  67  69  66  68  69  70  74  70  66  69  64  62  70  68  65  NA  71  66
##  [325]  61  67  65  65  NA  62  60  61  67  70  69  66  64  68  67  64  65  66
##  [343]  68  66  63  63  74  70  66  63  67  71  NA  72  68  66  70  66  72  61
##  [361]  62  68  68  63  70  68  72  67  61  69  75  NA  65  75  64  70  67  63
##  [379]  67  86  67  63  66  67  NA  66  64  73  68  70  67  62  68  72  69  66
##  [397]  70  71  65  70  65  62  62  70  66  67  72  66  68  62  64  65  66  67
##  [415]  69  68  64  68  64  71  61  68  64  72  NA  68  NA  66  63  74  63  72
##  [433]  69  67  66  64  67  69  64  65  72  66  66  67  69  73  69  68  61  63
##  [451]  68  63  65  68  66  66  70  61  71  70  69  61  68  74  67  70  64  66
##  [469]  63  61  68  65  69  68  69  70  68  67  67  75  70  70  64  59  63  67
##  [487]  68  68  97  66  61  70  65  64  69  64  61  64  68  67  62  66  72  71
##  [505]  65  68  65  64  65  65  73  72  64  69  69  70  83  68  84  75  67  69
##  [523]  66  65  70  66  74  68  68  62  71  63  69  71  66  64  65  69  66  67
##  [541]  65  65  67  66  69  70  68  70  67  72  69  69  64  63  70  70  66  70
##  [559]  66  68  61  NA  69  72  65  74  62  65  68  71  NA  65  68  70  63  63
##  [577]  69  66  70  63  72  63  65  NA  80  68  64  73  66  66  66  59  68  67
##  [595]  64  65  68  70  NA  72  62  68  73  69  67  65  63  66  66  70  69  70
##  [613]  58  67  66  70  67  60  65  63  72  NA  70  70  64  64  72  66  66  71
##  [631]  66  64  66  62  70  69  65  70  70  67  69  62  67  65  65  69  63  66
##  [649]  67  69  67  70  67  70  65  63  NA  69  60  69  72  63  63  70  NA  69
##  [667]  72  67  68  70  68  69  68  66  72  67  70  73  73  60  67  69  65  65
##  [685]  64  67  65  64  67  70  63  71  68  67  67  68  66  68  70  67  67  62
##  [703]  67  70  72  70  94  66  69  68  71  69  67  64  63  66  69  64  62  70
##  [721]  67  68  62  68  64  64  66  72  72  66  NA  69  72  69  69  62  70  68
##  [739]  68  70  65  73  66  71  62  68  70  68  70  72  69  63  62  68  69  68
##  [757]  65  59  66  63  72  NA  94  70  66  69  64  63  71  65  68  64  64  67
##  [775]  66  NA  66  71  71  68  64  67  64  68  62  64  68  69  65  67  71  65
##  [793]  65  65  68  68  67  65  66  63  72  67  67  66  66  69  62  66  64  67
##  [811]  71  68  66  75  72  68  68  69  63  70  66  66  71  72  69  71  69  68
##  [829]  NA  68  72  70  73  67  65  68  65  NA  66  67  70  NA  69  62  68  67
##  [847]  68  69  62  75  65  63  66  71  66  NA  66  68  71  68  68  62  65  71
##  [865]  63  68  69  69  71  71  62  NA  70  71  69  65  71  68  64  67  NA  71
##  [883]  62  67  66  NA  65  64  65  68  72  64  62  69  64  61  72  66  69  65
##  [901]  64  66  62  66  70  75  67  66  NA  NA  72  65  67  63  62  69  70  63
##  [919]  71  63  71  63  65  66  66  66  66  67  68  68  69  64  67  63  64  66
##  [937]  65  68  66  71  74  65  68  68  72  NA  61  65  63  66  66  73  63  73
##  [955]  63  65  65  66  65  70  68  64  68  62  61  69  65  65  NA  70  65  69
##  [973]  65  69  65  72  70  64  67  69  70  65  69  74  66  72  75  70  63  65
##  [991]  64  NA  NA  67  67  68  65  61  63  80  69  NA  70  65  68  64  69  89
## [1009]  67  92  67  70  68  70  67  69  67  69  63  66  68  69  66  72  62  67
## [1027]  67  67  65  67  66  70  71  64  72  60  71  71  NA  74  64  68  66  64
## [1045]  65  69  63  65  62  67  64  61  65  70  59  75  67  64  72  76  69  65
## [1063]  72  69  71  64  74  68  66  65  67  69  66  67  64  67  NA  68  66  66
## [1081]  63  66  66  65  69  71  66  66  65  71  69  61  70  70  65  64  68  63
## [1099]  71  58  68  65  65  68  69  71  65  64  75  67  68  NA  67  72  69  68
## [1117]  70  69  63  61  66  73  67  72  69  69  63  67  63  66  62  68  65  59
## [1135]  72  63  68  61  65  68  61  67  66  75  68  65  NA  64  67  63  67  65
## [1153]  62  69  70  68  68  64  63  68  67  68  66  67  69  70  68  66  67  65
## [1171]  67  63  64  64  66  68  67  72  67  66  66  67  65  70  69  69  66  66
## [1189]  67  67  67  72  68  70  69  65  72  69  68  62  60  67  67  67  63  71
## [1207]  66  65  69  63  64  67  62  68  66  69  71  66  70  65  64  63  63  66
## [1225]  68  74  71  67  66  67  62  68  62  82  70  NA  64  66  68  64  61  69
## [1243]  64  67  67  65  68  67  64  70  69  66  69  66  73  66  69  70  71  70
## [1261]  69  63  NA  73  68  69  76  68  65  65  69  66  69  59  65  NA  64  69
## [1279]  70  67  67  NA  68  72  65  NA  75  65  63  71  66  69  68  71  77  70
## [1297]  66  NA  NA  NA  66  72  NA  63  72  71  72  65  67  68  66  71  70  68
## [1315]  72  66  65  62  69  65  69  69  75  70  74  65  63  74  67  71  68  69
## [1333]  71  66  65  66  65  67  70  63  64  71  68  72  71  64  64  66  68  65
## [1351]  67  64  70  65  65  68  61  69  64  69  67  NA  66  72  73  73  63  69
## [1369]  71  63  69  72  68  62  68  71  67  65  68  59  71  70  62  62  68  68
## [1387]  61  67  65 101  65  67  NA  NA  64  67  69  67  62  66  72  67  66  67
## [1405]  67  68  63  NA  65  65  70  73  73  68  63  62  69  66  68  67  65  70
## [1423]  64  65  67  62  66  68  64  69  67  61  70  65  66  66  69  67  71  68
## [1441]  67  63  64  73  69  65  70  67  67  NA  69  68  NA  67  71  68  66  64
## [1459]  71  61  67  65  66  68  66  63  66  73  88  67  69  67  64  64  65  68
## [1477]  77  63  69  70  73  NA  71  66  71  66  63  70  66  66  66  62  69  63
## [1495]  68  NA  69  71  71  66  72  70  71  65  65  68  70  70  72  65  65  71
## [1513]  64  65  73  72  65  66  66  68  67  65  64  70  63  65  67  71  73  67
## [1531]  72  71  72  68  65  68  67  66  64  65  69  68  69  70  65  71  68  70
## [1549]  72  NA  64  NA  NA  71  69  67  66  71  63  62  NA  66  72  67  65  66
## [1567]  68  69  68  61  68  64  67  68  61  66  64  67  64  72  62  63  70  69
## [1585]  64  66  67  71  70  69  64  70  69  60  65  67  66  68  58  67  62  69
## [1603]  73  66  67  71  NA  74  67  68  61  65  71  61  70  70  69  70  67  63
## [1621]  70  61  64  65  65  66  66  63  66  64  65  62  71  63  70  70  65  68
## [1639]  68  NA  71  68  67  72  68  60  68  NA  67  70  70  68  67  62  66  69
## [1657]  66  64  66  63  62  65  68  65  63  68  72  69  66  68  64  61  67  68
## [1675]  74  67  64  69  63  67  65  67  62  70  67  NA  65  69  64  74  64  64
## [1693]  67  63  68  66  68  68  69  71  65  67  65  65  80  74  59  69  66  66
## [1711]  65  67  69  68  73  71  67  67  66  63  65  NA  69  67  66  66  69  63
## [1729]  64  64  69  73  62  62  66  68  66  NA  62  NA  67  65  69  67  64  62
## [1747]  71  72  74  66  72  65  70  62  65  70  69  70  66  73  69  66  65  70
## [1765]  70  67  68  68  61  70  65  66  67  69  69  67  66  63  67  64  68  65
## [1783]  65  70  62  68  62  68  70  NA  73  68  68  69  63  74  61  69  64  63
## [1801]  68  72  69  70  63  62  72  69  66  71  62  68  63  66  NA  69  68  69
## [1819]  67  73  71  71  68  70  71  NA  63  71  69  71  68  68  66  67  59  66
## [1837]  64  NA  69  69  61  62  61  63  71  NA  68  67  70  64  71  71  67  63
## [1855]  66  70  70  67  69  66  67  65  72  68  72  76  65  68  65  66  63  63
## [1873]  66  72  64  67  66  68  65  71  62  69  65  70  70  70  69  NA  69  73
## [1891]  65  62  67  65  65  70  70  71  71  NA  65  84  68  70  68  67  69  68
## [1909]  59  67  NA  63  64  NA  66  67  66  66  68  66  68  65  67  64  59  60
## [1927]  65  66  65  69  62  60  68  64  73  64  63  65  65  67  66  65  66  66
## [1945]  70  71  70  68  NA  68  66  67  66  69  67  61  70  70  70  64  65  70
## [1963]  62  64  67  62  72  69  72  68  64  72  73  67  64  NA  67  68  71  NA
## [1981]  59  68  64  70  65  72  66  68  62  70  70  64  76  67  68  67  69  67
## [1999]  73  71  70  73  65  70  66  64  68  70  72  66  74  67  NA  60  69  71
## [2017]  66  65  60  69  69  67  65  70  71  73  70  67  67  65  68  74  68  61
## [2035]  67  66  69  62  71  71  72  69  67  NA  68  69  65  70  65  67  72  69
## [2053]  69  NA  67  65  70  63  71  64  69  69  70  64  70  74  69  73  66  67
## [2071]  76  61  68  63  67  66  62  67  66  63  64  67  66  68  NA  68  63  62
## [2089]  72  69  67  65  69  NA  70  91  65  62  65  NA  67  72  60  69  61  70
## [2107]  68  75  75  72  66  71  70  63  72  65  71  65  69  71  68  66  60  68
## [2125]  67  71  74  70  63  64  66  64  69  NA  64  65  69  68  68  68  65  65
## [2143]  66  66  71  68  65  63  66  71  65  68  66  64  70  70  71  70  70  66
## [2161]  64  66  68  61  72  66  68  61  67  66  74  66  67  71  66  71  72  66
## [2179]  62  66  69  69  69  64  68  63  64  69  71  67  66  67  NA  69  NA  66
## [2197]  63  67  66  66  67  66  69  72  60  68  72  64  65  76  59  67  NA  64
## [2215]  67  69  69  67  72  NA  62  69  68  99  70  68  67  66  66  62  72  68
## [2233]  66  68  75  67  65  68  67  67  73  67  71  67  68  68  NA  68  63  68
## [2251]  74  69  70  65  65  68  68  66  70  66  64  70  68  74  71  61  64  64
## [2269]  73  62  71  68  71  72  66  67  66  68  64  66  69  65  72  65  70  64
## [2287]  62  69  62  69  NA  NA  64  63  69  68  NA  64  66  71  72  NA  66  65
## [2305]  NA  62  68  65  62  74  NA  70  65  66  67  73  65  NA  66  67  58  71
## [2323]  63  73  NA  68  66  78  68  77  65  73  64  67  69  60  66  70  66  64
## [2341]  70  64  72  70  62  66  65  64  NA  71  68  68  65  64  75  61  68  NA
## [2359]  71  66  66  70  62  72  72  63  69  68  67  71  67  62  69  67  87  62
## [2377]  64  74  69  65  66  70  68  70  68  69  66  NA  71  66  61  NA  63  73
## [2395]  68  70  68  68  71  68  70  NA  69  73  72  67  69  68  64  71  68  70
## [2413]  72  65  70  69  64  67  65  62  68  68  68  68  NA  72  69  68  71  69
## [2431]  71  65  68  60  NA  66  66  62  61  69  69  74  62  67  69  66  NA  69
## [2449]  65  72  69  61  63  63  68  68  65  71  64  65  67  67  67  87  67  72
## [2467]  69  65  66  70  71  67  72  63  67  72  72  NA  67  68  70  67  69  74
## [2485]  63  72  71  69  62  NA  68  67  71  70  NA  60  69  71  NA  73  68  67
## [2503]  74  NA  69  69  68  66  69  68  65  71  61  63  66  69  71  73  72  73
## [2521]  65  71  65  67  69  63  68  70  64  64  68  65  66  70  66  69  64  64
## [2539]  69  67  63  67  65  64  68  64  70  70  69  70  65  70  63  74  70  66
## [2557]  68  67  66  66  69  67  69  66  64  61  61  70  65  67  69  63  66  73
## [2575]  68  74  70  68  67  65  66  64  72  70  60  68  71  68  67  70  65  60
## [2593]  65  70  69  64  67  NA  74  67  66  69  64  NA  66  65  67  67  68  65
## [2611]  66  65  71  63  70  70  67  68  63  70  69  66  70  68  70  67  64  62
## [2629]  NA  62  66  64  72  NA  65  65  70  68  57  59  64  67  60  67  71  67
## [2647]  69  68  59  75  59  71  71  66  69  65  NA  68  88  66  67  63  68  65
## [2665]  67  67  67  64  65  70  67  68  65  63  72  68  71  70  68  68  68  71
## [2683]  70  67  61  64  67  65  66  62  70  64  70  66  62  63  66  58  70  63
## [2701]  65  NA  73  82  71  73  65  67  67  69  61  64  64  68  62  70  67  70
## [2719]  65  65  70  72  65  71  71  72  64  72  71  66  71  67  69  67  62  67
## [2737]  NA  NA  69  70  NA  65  66  68  72  65  60  63  73  71  59  70  63  67
## [2755]  65  64  71  NA  63  68  67  66  63  65  66  65  65  63  65  62  66  71
## [2773]  64  67  68  63  64  74  68  68  69  61  69  NA  67  63  68  68  67  69
## [2791]  64  67  70  72  NA  62  67  64  64  70  68  NA  65  59  69  67  68  62
## [2809]  65  69  65  68  68  71  71  66  66  66  65  66  67  66  69  66  64  70
## [2827]  NA  67  60  66  72  63  69  NA  69  68  66  63  70  68  68  67  67  69
## [2845]  68  67  70  70  NA  61  68  64  66  73  66  65  68  69  72  63  65  69
## [2863]  62  66  69  67  94  71  66  71  66  60  60  66  67  67  64  66  68  70
## [2881]  NA  86  73  61  68  70  71  71  68  70  70  62  67  68  68  64  69  70
## [2899]  73  66  68  68  66  62  67  73  65  70  68  67  66  65  66  66  60  NA
## [2917]  72  68  67  62  69  NA  64  65  75  69  65  60  69  65  67  70  66  69
## [2935]  69  68  70  66  65  65  65  69  69  65  NA  72  67  74  66  66  66  71
## [2953]  66  69  69  68  64  73  66  67  63  61  71  61  62  74  65  NA  66  76
## [2971]  67  71  65  68  68  67  64  60  73  69  70  64  64  65  62  72  64  67
## [2989]  64  61  72  70  70  71  68  68  70  73  69  71  64  NA  69  70  66  65
## [3007]  66  61  71  60  66  61  68  68  65  65  60  67  65  70  64  68  69  NA
## [3025]  65  65  68  66  65  71  68  62  61  70  62  65  68  70  68  69  73  71
## [3043]  63  66  67  66  69  72  NA  67  64  68  71  67  67  64  63  72  63  67
## [3061]  68  64  65  68  66  73  68  72  70  66  66  66  65  71  66  63  58  61
## [3079]  65  67  67  62  86  71  70  71  71  70  67  60  73  NA  62  67  61  61
## [3097]  60  68  65  67  67  74  64  64  67  74  69  62  69  68  74  68  73  70
## [3115]  68  64  71  65  68  67  NA  63  68  66  67  68  72  70  62  69  61  58
## [3133]  63  71  70  64  63  63  71  65  68  70  68  69  70  67  69  67  67  NA
## [3151]  63  67  70  71  74  70  59  64  67  63  66  62  65  73  70  62  NA  96
## [3169]  66  69  70  73  69  71  65  62  65  68  65  67  68  66  62  65  70  68
## [3187]  72  NA  63  67  69  NA  67  69  63  65  58  70  66  63  62  69  66  68
## [3205]  62  64  65  65  65  70  71  65  68  73  64  71  70  68  68  68  59  74
## [3223]  62  64  76  70  69  74  62  70  71  68  66  67  71  74  65  60  69  65
## [3241]  69  70  65  57  68  67  70  68  62  67  66  60  75  67  71  63  67  68
## [3259]  65  72  61  60  72  NA  67  71  66  70  64  66  NA  67  67  64  61  99
## [3277]  NA  72  66  64  69  65  66  73  66  65  71  58  69  63  66  69  69  63
## [3295]  65  76  67  70  60  68  68  68  69  62  64  71  68  72  64  73  69  70
## [3313]  69  64  66  69  NA  65  62  75  60  63  66  67  68  72  66  63  71  67
## [3331]  NA  66  68  66  68  68  66  66  70  68  65  70  66  68  64  65  NA  66
## [3349]  68  70  65  65  68  67  72  70  72  71  64  69  NA  70  68  71  71  NA
## [3367]  68  70  72  66  65  66  65  72  68  68  67  68  67  NA  65  70  64  66
## [3385]  64  66  67  68  71  67  69  67  61  68  67  64  63  72  69  66  64  61
## [3403]  63  65  71  78  65  66  66  74  62  66  71  67  69  72  72  65  71  64
## [3421]  69  65  69  64  69  68  NA  66  66  67  62  66  68  68  63  66  72  70
## [3439]  63  65  65  66  68  64  66  68  64  62  67  65  59  66  NA  63  68  66
## [3457]  NA  66  69  64  68  66  68  62  68  69  70  65  68  67  64  66  67  63
## [3475]  69  70  70  65  NA  67  61  70  68  64  68  68  65  69  63  69  61  69
## [3493]  62  58  71  NA  68  61  67  72  71  67  68  64  73  65  67  63  63  69
## [3511]  68  68  69  73  66  68  65  67  70  64  69  71  68  68  66  70  65  NA
## [3529]  70  67  63  64  60  62  65  69  66  72  68  69  65  65  70  67  73  70
## [3547]  66  68  61  70  66  67  69  64  65  75  63  69  68  66  66  66  68  65
## [3565]  70  68  70  61  64  71  72  66  63  62  66  72  68  NA  70  73  67  65
## [3583]  NA  65  70  66  65  68  66  71  65  70  69  67  82  66  66  65  61  72
## [3601]  70  71  84  72  70  62  71  62  68  74  68  NA  65  66  68  67  63  71
## [3619]  63  66  67  66  70  71  68  64  66  72  68  70  64  71  72  71  63  68
## [3637]  63  66  NA  NA  70  65  67  66  69  73  66  70  68  65  67  71  70  61
## [3655]  69  63  67  65  63  67  66  72  68  67  NA  66  73  71  65  65  65  68
## [3673]  70  NA  62  66  65  71  61  63  67  70  73  69  61  64  61  63  65  NA
## [3691]  68  72  62  58  68  74  68  67  65  63  71  62  65  66  71  68  72  66
## [3709]  66  67  71  72  64  60  NA  68  62  68  60  72  65  63  66  65  65  67
## [3727]  65  67  66  71  64  61  65  61  69  71  70  62  73  66  66  66  66  65
## [3745]  67  76  66  63  71  63  63  66  72  70  62  69  66  64  NA  67  71  69
## [3763]  70  70  61  NA  67  70  68  69  65  68  67  70  68  69  70  67  70  74
## [3781]  63  72  62  71  68  72  64  64  63  66  71  70  67  73  64  65  62  64
## [3799]  67  74  63  64  64  70  71  63  65  70  65  68  72  67  65  66  67  65
## [3817]  68  68  69  71  64  64  67  70  66  70  70  64  71  63  72  72  63  67
## [3835]  67  64  69  NA  71  70  98  65  63  61  67  64  65  73  69  67  NA  67
## [3853]  66  64  68  66  65  65  67  68  63  70  68  NA  NA  69  65  61  65  67
## [3871]  66  69  NA  68  65  64  68  64  70  68  NA  61  66  75  71  69  62  65
## [3889]  61  69  66  64  69  78  68  68  68  69  68  80  NA  64  64  68  65  66
## [3907]  67  64  66  63  71  62  64  72  NA  67  65  63  65  67  67  64  69  60
## [3925]  70  66  66  68  72  64  64  64  72  66  68  95  64  NA  68  67  67  71
## [3943]  63  66  65  68  68  62  67  NA  71  71  61  70  NA  70  67  66  63  65
## [3961]  75  66  61  65  61  73  63  67  62  71  70  70  69  66  72  63  65  71
## [3979]  66  69  62  66  66  64  68  68  67  68  65  NA  85  64  68  NA  65  63
## [3997]  64  62  68  63  68  63  68  62  67  66  65  69  64  75  66  62  70  NA
## [4015]  66  65  68  68  62  66  68  69  67  74  61  64  69  66  61  71  71  69
## [4033]  66  68  71  66  94  68  66  70  68  64  69  59  70  72  64  63  67  62
## [4051]  69  66  66  63  62  58  67  68  67  67  62  66  65  67  69  67  69  62
## [4069]  67  63  66  71  68  67  71  65  64  69  68  67  71  64  NA  69  67  58
## [4087]  66  69  70  70  70  66  61  71  NA  69  74  71  68  69  63  67  NA  66
## [4105]  69  68  63  69  66  71  68  69  65  68  67  65  65  64  69  64  66  65
## [4123]  69  66  64  61  72  67  63  69  70  71  60  70  69  63  69  71  68  64
## [4141]  68  69  65  68  74  72  67  73  68  70  62  67  69  93  68  69  68  64
## [4159]  69  66  68  72  63  NA  65  65  68  70  65  66  66  NA  64  66  63  68
## [4177]  68  65  69  66  72  NA  67  68  71  73  68  69  69  63  62  70  66  62
## [4195]  64  63  71  67  67  67  71  93  72  71  63  65  61  66  61  67  64  69
## [4213]  70  73  63  64  69  69  67  62  66  68  71  66  NA  68  59  70  66  65
## [4231]  66  73  65  65  NA  74  68  65  72  71  69  67  71  68  69  68  73  69
## [4249]  58  65  58  66  NA  67  67  65  71  66  68  65  71  NA  72  69  70  66
## [4267]  NA  62  66  70  73  70  71  NA  64  66  82  68  67  68  69  63  66  68
## [4285]  71  69  70  70  NA  68  65  72  67  68  69  70  69  68  65  70  65  61
## [4303]  69  67  65  63  67  76  70  67  66  65  65  63  72  68  62  65  69  61
## [4321]  67  66  70  72  69  68  74  70  67  68  69  66  68  69  66  NA  66  64
## [4339]  63  68  65  65  68  62  67  73  69  65  66  73  72  72  61  69  66  74
## [4357]  66  66  72  70  67  71  63  NA  64  65  65  62  65  64  NA  67  66  NA
## [4375]  68  58  65  68  64  66  92  69  68  63  64  68  67  68  66  68  64  63
## [4393]  62  66  65  66  66  69  67  NA  73  66  61  NA  67  66  69  69  67  65
## [4411]  63  63  66  66  69  72  70  68  66  67  68  62  64  71  65  69  65  71
## [4429]  69  65  66  68  72  74  64  64  63  66  67  64  62  71  63  72  71  61
## [4447]  71  69  61  68  67  70  69  72  66  67  70  68  68  65  63  62  66  62
## [4465]  61  63  64  74  70  68  69  62  71  69  68  65  65  72  63  72  66  71
## [4483]  67  61  70  68  70  65  65  65  65  66  62  63  63  70  67  66  63  66
## [4501]  67  68  67  66  71  69  72  70  68  68  67  62  67  69  64  66  69  70
## [4519]  69  72  61  NA  68  NA  65  66  67  68  67  63  64  66  69  70  72  63
## [4537]  68  67  69  69  71  67  64  68  67  62  68  72  61  67  70  59  70  60
## [4555]  74  68  67  67  63  62  64  68  65  71  68  68  68  67  NA  70  69  70
## [4573]  69  59  64  70  63  66  72  71  62  62  64  65  68  67  61  68  68  62
## [4591]  62  74  68  66  65  66  67  76  66  68  63  65  63  59  74  62  59  71
## [4609]  73  68  68  66  69  70  74  75  71  71  65  NA  65  67  67  71  72  62
## [4627]  70  72  64  66  69  71  68  71  66  68  61  71  70  66  61  67  72  65
## [4645]  68  70  63  69  62  71  64  71  72  66  69  60  68  65  67  66  68  63
## [4663]  NA  66  67  66  60  67  NA  70  69  68  67  63  70  71  67  64  66  70
## [4681]  65  68  65  65  69  70  64  62  73  62  62  72  67  68  65  79  66  68
## [4699]  65  67  67  68  72  65  65  70  68  63  68  69  NA  64  69  62  65  70
## [4717]  72  66  70  67  65  68  68  69  72  65  63  68  62  69  65  65  70  59
## [4735]  63  64  63  67  65  64  65  72  72  66  62  68  67  69  67  63  65  71
## [4753]  70  68  65  68  69  NA  62  72  64  58  66  64  68  69  71  71  62  70
## [4771]  63  66  65  69  63  64  66  67  66  65  72  70  67  72  65  62  67  64
## [4789]  72  66  70  66  67  NA  72  68  64  66  68  66  NA  70  69  69  66  68
## [4807]  71  64  67  68  68  69  71  68  65  63  65  72  67  69  67  64  62  71
## [4825]  64  69  65  73  64  64  70  70  64  74  69  67  73  66  67  75  73  67
## [4843]  65  71  63  68  72  NA  67  66  72  64  68  65  74  65  63  65  70  71
## [4861]  66  NA  67  64  67  NA  70  71  68  65  70  67  63  65  70  67  60  65
## [4879]  64  67  71  69  70  69  63  67  66  69  69  72  65  63  69  69  64  69
## [4897]  72  62  66  65  65  67  63  66  61  64  65  68  69  61  72  61  66  60
## [4915]  69  72  69  71  64  71  64  67  67  66  73  73  70  70  62  68  65  73
## [4933]  66  64  63  62  70  NA  64  70  62  67  66  74  69  70  68  71  73  69
## [4951]  61  68  66  67  64  67  61  62  69  61  69  64  65  64  68  67  68  61
## [4969]  69  64  74  66  68  65  66  66  65  67  65  63  67  70  68  66  NA  72
## [4987]  68  66  62  67  62  67  68  66  68  62  68  62  69  62  71  69  66  64
## [5005]  65  NA  69  68  71  66  65  72  67  67  70  64  65  68  67  66  69  64
## [5023]  68  68  65  65  65  67  63  62  73  72  71  67  66  68  70  66  56  71
## [5041]  64  NA  70  70  71  70  62  72  62  67  NA  60  72  66  66  69  70  70
## [5059]  70  67  67  59  68  71  61  63  67  70  69  66  70  67  61  74  70  66
## [5077]  73  65  64  63  69  NA  65  NA  69  71  68  70  71  68  69  71  63  66
## [5095]  67  71  59  66  72  70  68  63  69  75  67  74  66  65  60  63  69  68
## [5113]  65  74  65  61  67  66  69  65  65  66  73  64  67  67  68  71  64  67
## [5131]  68  67  70  64  63  71  64  70  70  67  62  NA  69  NA  70  69  65  66
## [5149]  69  66  65  66  72  62  64  61  70  67  66  66  68  67  65  70  68  61
## [5167]  65  71  66  61  67  66  71  62  67  64  68  67  63  70  67  71  62  75
## [5185]  72  73  64  66  69  70  70  71  64  71  63  68  71  66  72  65  60  67
## [5203]  65  64  72  62  67  67  69  65  62  69  72  63  64  67  70  64  69  72
## [5221]  69  75  67  67  64  68  65  70  57  69  70  63  66  64  62  71  64  72
## [5239]  64  71  68  68  68  69  67  66  65  63  62  67  65  66  64  67  67  61
## [5257]  66  66  67  64  67  68  64  63  68  64  70  64  59  71  67  73  66  73
## [5275]  62  69  66  NA  65  67  64  67  66  NA  68  64  63  72  75  71  66  71
## [5293]  NA  NA  58  62  69  65  69  68  70  72  66  68  67  61  64  74  64  64
## [5311]  61  71  72  68  69  74  70  69  64  71  65  71  66  64  NA  71  65  59
## [5329]  63  64  63  70  70  NA  65  71  70  66  64  64  59  65  NA  67  62  70
## [5347]  75  66  65  64  70  71  68  64  67  65  62  68  66  68  NA  68  66  70
## [5365]  60  69  65  NA  64  71  66  66  68  NA  66  61  70  68  65  69  67  62
## [5383]  61  65  65  66  NA  69  70  63  64  65  71  61  69  69  66  72  60  62
## [5401]  66  69  69  71  57  72  66  70  67  65  68  63  63  68  60  67  65  68
## [5419]  62  65  66  67  60  74  62  61  NA  66  NA  72  70  71  64  70  68  61
## [5437]  68  64  64  NA  72  66  74  65  64  69  62  62  72  73  64  65  70  66
## [5455]  70  69  64  63  66  68  97  71  66  72  70  69  66  69  65  75  70  70
## [5473]  69  73  74  66  74  67  67  70  67  80  70  71  64  68  68  69  72  65
## [5491]  64  64  58  69  61  68  66  68  70  62  71  61  NA  65  63  74  68  65
## [5509]  66  69  69  70  70  71  72  61  68  66  70  NA  62  69  69  64  63  69
## [5527]  61  70  64  76  73  69  72  70  73  68  66  67  67  62  72  65  69  69
## [5545]  69  69  69  70  67  69  75  66  63  64  66  72  71  70  67  65  65  73
## [5563]  66  NA  71  66  65  75  74  65  71  65  65  67  66  67  66  65  59  63
## [5581]  65  61  68  65  72  59  63  69  70  67  66  68  71  69  66  66  74  66
## [5599]  72  69  68  71  61  65  71  59  71  72  71  67  67  74  63  68  NA  66
## [5617]  67  70  65  68  70  66  69  65  68  65  70  NA  NA  64  70  64  67  68
## [5635]  67  66  66  67  NA  NA  68  67  69  64  67  67  67  67  68  65  70  68
## [5653]  72  67  66  68  75  66  67  71  68  65  67  66  60  NA  64  72  60  NA
## [5671]  62  70  65  77  71  66  74  70  NA  64  NA  68  63  61  61  65  69  69
## [5689]  65  72  69  71  67  72  70  68  66  68  71  70  65  65  68  69  66  62
## [5707]  70  65  71  68  65  70  69  66  67  63  70  65  70  74  68  64  73  66
## [5725]  66  67  67  69  69  68  64  70  67  68  67  73  65  69  63  68  64  68
## [5743]  66  65  69  69  74  64  63  64  71  NA  72  67  64  70  65  69  65  66
## [5761]  67  68  65  68  63  65  61  68  65  66  65  NA  70  70  67  75  65  66
## [5779]  62  64  60  70  72  67  67  72  63  60  NA  72  70  71  66  NA  73  71
## [5797]  64  66  69  66  63  62  98  71  66  75  68  69  68  60  64  71  69  60
## [5815]  70  66  68  67  69  75  65  65  66  64  70  63  66  71  68  68  71  63
## [5833]  NA  73  68  70  66  72  70  68  60  68  74  68  72  69  98  68  70  64
## [5851]  65  67  65  70  68  65  74  65  68  74  67  64  66  61  73  70  70  63
## [5869]  69  NA  68  65  68  69  66  58  67  65  62  65  69  70  70  63  69  64
## [5887]  69  70  64  65  70  60  68  61  68  61  64  66  70  65  74  66  65  69
## [5905]  69  66  63  69  65  67  67  65  69  NA  67  66  64  70  65  65  64  64
## [5923]  61  65  68  70  74  60  71  70  67  68  64  67  65  72  65  71  72  70
## [5941]  63  67  67  62  72  69  61  67  66  68  62  63  70  68  71  65  59  64
## [5959]  67  68  95  70  68  65  NA  67  69  68  72  71  75  70  66  67  70  71
## [5977]  64  65  64  62  64  66  64  71  NA  70  71  68  66  66  65  64  67  65
## [5995]  69  69  69  68  67  68  65  69  73  76  69  69  68  70  NA  73  64  65
## [6013]  62  64  69  67  65  63  66  70  70  67  65  66  66  72  64  71  70  64
## [6031]  70  67  NA  68  69  68  68  64
as.numeric(czynniki4$Sleep_Hours)
##    [1]  7  8  7  8  6  8 NA  6  6  8  6  8  8 NA  8 10  6  9  7  5  6  8  8  5
##   [25]  6  6  4  4  7  8  5  6  7  9  8  6  8  6  7  7  9  8  6  6  7  5  7  8
##   [49]  8  7  5  5  6  8  8  7 10  9  8  8 NA  4  5  7  7  7  7  4  8  7  7  8
##   [73]  7  7  6  4  5  7  7  7  6  5  7  7  8  6  4  4  6  7  7  6  5  4 NA  7
##   [97]  6  5  6  7  7  7  9  6  9  7  7  8  6  7  5  8  8  9  9  6  8  6  7 10
##  [121]  8  8  6  7 NA  9  7 NA  5  9  6  8  6  8 NA  9  8  6  8  8  5  5  5  5
##  [145]  8  8  4  6  5  8  6  5  7  8  6  7  6  9  6  6  7  7  8  9  9  6  7 NA
##  [169]  9  6  8  8  8  9 NA  6  8  7  4  5  8  8  5  9  7  5  6 NA  6  4  7  8
##  [193]  5  7  6  8  4  8  4  7  6 NA  5  9  5  5 10  7  5  7  4  6  7  9  7  7
##  [217]  6  9  8  8  7  5  9  7  7  8  7  5  7  7  9  4  7  8 NA  6  5  6  9  4
##  [241]  5  6  6  7  9  5  7  7  6  5  6  6  8  8  5  6  6 10  7  5  6  6  8  7
##  [265]  7  7  7  4  7  5 10  7  7  6  8  5  7  6  8  6  9  8  8  9  6  8  4  7
##  [289]  6  5  6  6  7  6  7  6  6  7  7  8  8  8  7  7  8  6  4  5  9  7  7  7
##  [313]  8 NA  7  8  6  8 NA  7  6  7  6  9  4  8  8  6  8  7  5  9  8  8  6  8
##  [337]  5  4  5 NA  6  6  6  4  7 NA  6  9  7  8 NA  8  7  5  6  7  4 NA 10  8
##  [361]  8  7  8  9  8  7  7  8  6  8  6  5  6 10  6 NA  6  7  4  5  6  5  7  5
##  [385]  7 NA  7  6  9  8 NA  6  8  9  8  5 NA  8  7  6  7  7 NA  8  6  7  9  7
##  [409]  8  5  8  8  6  7  7  8  6  7  9  9  8 NA  9  7  7  6  8  8  7  5  8  6
##  [433]  7  9  5  7 NA  7  7  8  7  8  7  7 NA  7  6  8  7  6  9  7  5  7  7  7
##  [457]  6 NA 10  4  5  6  6  5  6  7  5  8  5  8  8  6  5  8  6 NA  8  6  7  6
##  [481]  9  6  7  8  7  8  7  5  7 NA  7  9  4  8  6  6  9  7  6  8 NA  9 10  8
##  [505]  7  5  9 NA  8  8  7 NA 10  7  6  9  7  7  9  8  8 NA  5  6  7  7  8  8
##  [529]  5 10  7  9  4  7  5  6  7  6  9 10  6 NA  5  9  7  7  7  8  5  7  6  7
##  [553]  8  6  9  4  9  9  6  6  5  8  7  5 NA  6  7  7  6  6  8 NA  9  6  4  6
##  [577]  6  5  7  7  4  7  9  8  7  4  6  9  6  6  5  7  7  6 10  8  7  4  8 10
##  [601]  7  6  5  8  9  6  6  7  6  5  6  6  9  9  8 NA  6  9  8  5  6  5  4 NA
##  [625]  5  6  6  9  5  5  8  6  6  5  8  7  7  6  6  7  8  9  9  8  8  6  8  7
##  [649]  8  8  8  5  7  6  6 NA  7  4  8  9  8  7  9  6  7 10  5  5  8  7  6  5
##  [673]  4  5  9  7  4  9  9  9  6  7  7  8  9  7  8  7  7  6  5  6  6 NA  9  7
##  [697]  6  8  7  8  6  9  9  7  8  9  6  7  7  5  8  9  7  8  9  6  6  6  8  8
##  [721]  7  8  9  8  7  7  8  7  8  9  7  4 10  7  9 10  9  7 10  9 NA  6  4  8
##  [745]  9  8  4  5 10  7  9  5  7  7  6 10  7  5  5  8  6  6  8  4  6  5  6  7
##  [769]  7  7  9  7 NA 10  7 10  7  7 NA  7  9 10  4 NA  6  4  8  8  8  8  7  8
##  [793]  7  7  7  5  8  5 NA  7  5  6  6  9  7  8  9  9  7  6  8 NA  8  7  8  7
##  [817]  6  8  7 10  6  8  6  4  8  6  9  8  7  5  8  6  5  8  5  4  9  6  4  6
##  [841]  6  9  5  5  8  6 NA  6 NA NA  7  9  6  6  8  9  6  7  8  9  8  6 10 NA
##  [865]  7  8  8 10  7  7  9  7 NA  8  8  4  4 NA  7  7  7  8  8  8 NA  7  7  9
##  [889]  6  7  7  9  4  7  8 10  7  6 10  8  9  8  5  5  8  8  6  9  6  7  7  9
##  [913]  5  6  5 10  7  6 NA  8  8  6  5  7  9 NA  6  5  8 10  8  6  6 10  6  7
##  [937]  7  8  9  9  7  7  8  6 NA  7  8 10  8  7  6  7  5  4  8  8 NA  7  4  8
##  [961]  9  8  7 NA  6  7  7  6  7 NA 10  7  6 NA  9  9 10  7  8  5  6  5  8  7
##  [985]  7  6  4  7  7  4  8  7  8 10  7  8  9  8  6  5  8  6  9  6  7  5  6  6
## [1009]  6  7  6 10 NA  9  7  7  6 10  7  6 NA NA  9  6  6  9 10  7  9  5  6 NA
## [1033]  8  7  9  6  7  5  9  9  8  7  6  7  8 NA  9  9  6  7  6  6  9  7  7  7
## [1057]  7  6 NA  6  6  7 NA  6  8  7  7  8  4  6  8  7  7  6  9  8 NA  9  6  8
## [1081]  8  7  7  9  6  9  6  7  6 10  7  5  7  8  7  6  9  5  6  7  6  8 10  6
## [1105]  9  5  8  6  8  4  5  8  6  7 10 NA  8  6  7  5  6  7  7  8  8  5  6  4
## [1129]  6  8  9  7  9  8  7  6  4  9 NA  9 NA  7  6  7  7  7  6  6  9  6  4  5
## [1153] NA  7  6  9  8 10  6  7  9  8  6  8  8  6  7  9  8  6  6  8  4  6  9  7
## [1177]  6  5  8  7  7  8  7  7  5  5  8  8  8  6  8  6 NA  6  6 NA  8  7  7  6
## [1201]  7  7  6  7  7 10  6  6  7  6  5  5  6  6  7  4  8  6  8  8  6 NA  9  5
## [1225]  8 NA  9  6  6 NA  8  6  7  6  5  7  6  6  9  6 NA  9  6  7  8  8 10  6
## [1249]  5  8  7  7  6  6 NA  6  7 NA  5  5  6  9  6  5  6  5  8  5 NA  7  8  8
## [1273]  5  9  7 10  9  7 10  7 10  8  8 NA NA  8  7  7 NA  8  8  6  7  4  8 10
## [1297]  7  5  8  6  8  8 NA  7  8  7  6  8  5  7  5  6  6  9  9  9  6  8  7  7
## [1321]  4  8  7  8  8  6  7  5  9  8  6  8  7  6  7  8  8 10  7 NA  8  7  6  6
## [1345]  4  8  5  6  7 10  5 10  9  8  9  8  4  6  7  6  8  7  8  7  7  6  5  7
## [1369]  6  9  5 10  7 NA  6  8  7  7  8  9  6  7  7 10  7  8  8  8  6  6  7  4
## [1393]  7  6  7  7  5 NA  8  7  8  5  9  8  7 NA  9  6  5  6  7  7  9  6  6  5
## [1417]  8  5  8  6  6 10  9  7  5 10  7  7  8  4  7  7  5  7  7 10  9  7  7  9
## [1441]  7  5 10  6 10  8  6 NA  8  5  8 10  5  6  9  7  7  9  8  6 10  5  7  6
## [1465] NA  5  7  8  9  9  7  6  9  6  5  8  9  6  8  8  6  9  5  6  6  5  8  8
## [1489]  8  7  8  7  6  6  4  9  9 10  6  6 NA  8  9  6  8  9  8  5  7  4  5  5
## [1513]  7  7  7  5  7  8  8  8  8  8  8  5  5  6 NA  7  7  4  7  7  4  7  5  6
## [1537]  8  7  6  6  6  7  5  9  5  8  6  7  8  6  7  8  9  6  6  8  7  7  9  4
## [1561]  5  4  9  8  5  7 NA  4  7  5  8  5  7  9  8  8  7  5  6  7  7  5  8  5
## [1585]  9  7  8  8 10  7  6  9  5  7  7  8  5  7  7  5  7  7  6  6  5  8  9 10
## [1609]  8  6  6  7  7  7  9  6  9  7  6  6  7  8  6  8  6  7  5  8 NA  9  8  7
## [1633]  9  8  9  6  8  9  5  5  4  5  6  8  7  6  5  7  8  8 10 NA  7  7  7  6
## [1657]  4  5  8  7  8  8  8  8  7  7  4  6  6  7  6  8  6 NA  6  6  6  6  9  7
## [1681]  7  6  7  7  7  9  7  5  7  6  8  7  9  6  7  5  7  5  7  7  7  8  7  5
## [1705]  6  7  7  7  9  7  8  4 NA 10  9 NA 10  7  7  7 NA  4  8  7  7  7  9  8
## [1729]  7  7  6  7  8  7  7  8  5  6  5  7  8  9  9  6  7  6  9  9  7  6  4  5
## [1753]  5 10  5  6 10  7  8  7  4  9  8  7 10  6  7 NA NA  8  7  5  6  5  9  5
## [1777]  9  9  6  6  6  9  9  6  9  9  7  7  9  9  8  7  9 10  6  7  8  8  6  9
## [1801]  6  6  6  5  8  7  9  8  4  9 10  9  9 NA  6  7  8  8  6  6  5  8  6  7
## [1825] 10  8  7  8  9  5  6  7  6  7  5  8  6 NA  7  8  4  8  7  8  5  8  9  7
## [1849]  6  6  8  8  8  7 NA  7  6  8  7  9  9  7  8  6  7  8  5  8  6  6  6  7
## [1873]  5  7  7  6  5  8  5 10  8  8  7  6  6  5  7  9  5  9 NA  8  8  7  7  6
## [1897]  7  7 NA  8  7  7  6  6  8  6  6  6  6  9  7  7  7  5  9  8  8  8 10  6
## [1921]  5  8  5  7  7  8  6  6  8  6  7  9  7  9  7  6  8  4  8  6  8  7  5  6
## [1945]  7  7  8  8  8  8 NA 10  8  8 10  7  6  9  9  7 10  7  8  9  7  9  6  6
## [1969]  9  7  6  7  8  5  8  8  9  7  7  7  7 10  5  8  7  7  8  9  8  9  7  7
## [1993]  5 10  7  8  9  6  9  7  9  8  7  5  8  4  8  7  4  6  6 NA  9  9  6  6
## [2017] NA  7  6  6  6  6  9  8  8  9  8  9  8  7  8  7  5  4 10  6  6  9  5  8
## [2041] 10 10  6  7  6  7  9  5  8  7  9  9  6  7  8  8  4  8  9  7  8  9  7  8
## [2065]  7  7  6  7 10  6 NA  7  9  9  6  6  6  6 NA  6  6 NA  7  7  6  5  9  7
## [2089] 10  8 10  8  7  6  6  9  7  8  8  8  6  9  7  7  8  7  4  9  9  4  5 10
## [2113]  7  7  6  5  7  8  7  8 NA  6  7  9  6  7 10  6  9  7 10  5  7  5  6  6
## [2137]  7  5 NA  8  5  6 10  7  4  5  7  7 NA 10 10  7  8  8  9  6  8  7  7  7
## [2161]  5  4  7  6  8  8  7  9  7  5  7  9  4  7  8 10  9  7  8  4  5  7  7  7
## [2185]  7  7  5  7  5  6  7  8  7  6  5  6  7  8  8  5  8  5  8  8  4  8 NA  9
## [2209]  6  7  8  8  8  6  8  8  7  6  6  9  8  7  7  4  7  5  7  9 NA  7  8  6
## [2233]  7  8 NA  7  9  8  5  5  4  5  7  9  6  8  4 NA  6 10  4  4  6  4  6  7
## [2257]  7  5  9  8  8  5  9  9  7  8  7 NA  7  6  7  9  6  6 NA  7  8  8  7 10
## [2281]  7  8 10  8  6  7  7 NA  6  9  8  7 NA  7  8 10  4  8  7  7  4  8  7  6
## [2305]  7  7  4  7  8  6  7  9  7  8  7 10  6  6  7  6  5  8 NA  6  5  4  8  5
## [2329]  7  8  8  5 NA  9  6  6  8  5  7  8  5  6  9  7  8  8  7  5  6  7  5  5
## [2353]  9 NA NA  8  6  4  6  7  7  7  7  6  8  5  8  6 10  7  6  6  6  8  8  8
## [2377]  7  8  9  8  7  8  5 10  8  8  7  4  7  7  6  6  8  9  7  6  7  7  8  6
## [2401]  8  8  6  4  6  9  4  9  4  6  6 NA  7  7  6  8 NA  7  6  8  8  6  6  6
## [2425]  7  8  7  4  8  5  6  7  7  8  6  6  7 NA  8  7  9  9  8  5  8  7  6  6
## [2449]  7  6  7  7  8  7  6  4  8  7  7  9  5  7 NA  8  4 NA  8  6  7  6 NA  8
## [2473]  5  5  9 10  8  8  7  7  7  9  7  7  7  9  7  7  6  5  9  9  9  5  9 10
## [2497]  9  9  8  8  5  6  7  7  8  4  7  8  8  8  8  8  7  6 NA  8 10  8  8  5
## [2521]  7  7  8  8  8 10 NA  8  8 10  8  8  8  9  6 10  4  7  7  7  9  8  6  6
## [2545]  7  9  7  7  8  7  9  7  7 NA  8  7 NA 10  8 NA  7  7  8  4  4  9  7  6
## [2569]  5  7  7  9  8  7  8  9  8  8  7  6  5  5  8  8  9  8  9  7 NA  5  7  4
## [2593]  7  9  7  8  7  6  7  9  8  6  5  7  6  7  5  9  7  7  6  7  7  6  7  9
## [2617]  4  7  6  9  7  5  7  8 10  4  9  5  7 NA  7  7  9  8  7  7  8  9  8  9
## [2641]  6  9  8  6  7  7  7 NA  6  7  6  6  9  7 10  7  9  7  7  8 NA  7  7  6
## [2665]  7  8  7  7  7  7  8  7  7  8  7  7  7  5  7 10  6  6 10 NA  9  7  7  8
## [2689]  7 NA  4 NA NA 10  8 NA  9  6  6  4  6  8  9  5  7  4  7 10  4 NA  8  8
## [2713]  6  9  6  8  9  8  8  8  9  7  6  7  6  6  9  8  8  9  8 10  4  6  7  7
## [2737] 10  8  6  8  4  7  7  6  7  6  6  8  8  6  6  6  7  6  9  7  8  5  6  8
## [2761]  8  5  7  7  6  8  5  6  8  7  7  7  8  8  8  7  6  6  5  6  6  9  5  9
## [2785]  7  7  8  5  6  5  6 NA  9  6  4  6  8  9  7  6  7  8  5  7  7  7  7  6
## [2809]  8  7  7  5  8  6  9  5  4  4  4  8  7  9  7  7  7  6  6  5  8  7  7 10
## [2833]  6  7  7  9  7  7 10  6  7  8  6  8  6 NA  8  7  5 NA  7  8  7  8  8  7
## [2857]  7  7  6 NA  8  9  6  8  9  9  5 NA  4  5  9  6  5  9  5  9  5  5  7  6
## [2881]  7 10  7  9  7 NA  4  8  8  6 10  6  5  8  5  7  8 NA  6  9  5  8  8  7
## [2905]  7  6  6  7  8  9  4  4  9  7  7  7 10  8  6  6 NA NA  9  6  5  9  5  8
## [2929]  6  9  5  6  8  8  9  8  8  9  5  6  5  4  8  9  8  8  7  7 10  9  6  9
## [2953]  9  8  8  5  5  5 NA  6  8  8  8  6  7  8  8  6  7  7  6 NA  6  7  6  6
## [2977]  8  6 NA  8  7  7  7  8  7  7  5  7  9  6  5  8  8  6  7  7 NA  8  6  8
## [3001]  6  9 10  6  8  7  8  6  7  6  7  5  7  5 NA  7  8  8  8  5  9  6  6  7
## [3025]  8  8  6  7  7  8  6  6  5 NA  8  9 NA  4  7 10  6  7  5  7  7  5  5  5
## [3049]  6  8  6  9  6  7  8  9  6  8  6 10  5  8  9  5  8  6 10  4  5  5  5 NA
## [3073] 10  9  7  6  8  7  6  5  7  7  6  6  8  8 10 NA  5  7  5 NA 10  9  9  9
## [3097]  4  8  6  8 10  9  7  9  4  8  8  8  8  8  4  7  6  8  6 NA  5  7  7  8
## [3121]  7  9  7 NA  7 NA  5  5  9  6  7  7 NA  9  7  6  6  8  8  8  7  5  8  7
## [3145]  7  5  6  8  7  8  9  8  8  6  6  9  6  8 10  8  7  5  7  9  7  9  8  7
## [3169]  5  6  6  8  7  9  7  6  6  7  6  9  7  6  5  7  8  6  7  8  7  5  5  4
## [3193]  8  5  7  6  6  6  6  9  6  8  9 NA  8  6  7  6  7  5  8  5  7  6  8  7
## [3217]  5  8  7  7 10  9  7  5  5  9  6  5  8  9  9  6  8  7  8  7  6  9  7  6
## [3241]  7  6  8  7  6 10  5  8  7  5  6  5  7  7 10  6  9  8  4  6  8 NA  6  6
## [3265]  7 10  6  7  8  5  5  5  5  9  8  8  8  7  7 NA  5 10 NA  6  7 10  9  8
## [3289]  8  6  8  7 NA  9  7  5  6  8  9  8  8  7  7  7  7  6  8 NA  5  6  8  8
## [3313]  4  8  7  6  7  5  7  5  6  6  8 NA  8 NA  7  8  9  5  6  8  9  7  5  7
## [3337]  8  7  5  9  6  8  4 NA  6  8  5  7  9  6  9  8  9  7  7 10  8  7  8  6
## [3361]  7  9  7  6  6  7  6  5  5  9  7  7  6  6  6  7  5  9  7  7  8  8  6  8
## [3385]  8  7  9  8 NA  9  7  7  8  7  8  6  4  8  5 NA  8 NA  4  7  7  8  5 NA
## [3409]  8  6 10  6  7  5  7  4  7  9  5  5  9  5 10  8  9  6  9 NA  8  6  5  7
## [3433]  7  6  9 10  7  6 10  8  8  9  7  7  9  8  6  6  9  9 10  6  7  6 NA  7
## [3457]  8  6  4  5  7 10  6  7  8  6  6  7  6  4  6  9  9  6  6  6  7  6  7 NA
## [3481]  8  6  6  8  8  7  8 10  8 10  7  9  9  7  6  6  8  5  6  8  4  5 10  9
## [3505]  6  5  5  8 10 10  5  7  6 NA  5  6  6  8  6  8  9 10  8  7  9  9  8  5
## [3529]  9  8  6  6  8  4  7  6  6  5  9  4  7  6 10  7  4  8  5  8  8  9  7  8
## [3553]  7  6  9  5  7  6  8 NA  6  7  9  6  6  5  6  7  7 10  4 10  9  7  6  7
## [3577] 10  6  7  6  6  6  5  7  7  6  4  7  7  7  8  6  9  8  8 10  6  9  9  7
## [3601] 10  7  7  7  8 NA 10  6  4 10  9  8  6  8  5  7  7  8  5 NA  7  8  7  6
## [3625]  4  5  6  5  8  7 10 10  9  6  9  4  9  4  7  9  8  5  7  8  7  6  8 NA
## [3649]  7  9 NA  6  9  9  6  6 10  7  7  7  9 10  7 10  6  7  8  6 NA  6  5  4
## [3673]  7  8  5  7  7  7  6  7  7  8  5  5  7  6  7  6  9  9  8  8  7  7 10  6
## [3697]  5 NA  5  5  7  8  5  6  8  6  6  5  6  6  7  8  7  7  8  6  8  5  7  9
## [3721]  7  9  7 10  4  8  4  7  9  9  8  7  8 10  8  6  8  6  8  8  8  7  9  6
## [3745]  7  7  9  6  7  6  8  5  9  8  6  6  9  8  6  6  8  8  8  7  8  7  6  9
## [3769] NA  7  7  6  7  6  8  7  5  7  6  4  7  9  7  8  7  6  6  5  8  8  7  4
## [3793]  8  6  7  5  7  7  4  9  7  7  8 NA  8  5  4  7  9  5  6  4  7  8  8  6
## [3817]  4  5  9  8 NA  5  9  6  8  5  7  9  6  8  5  6  8 NA  8  6  5  6  9  6
## [3841]  9  7 10 10  9  5  4  7  8  8  6  5  8 10  6 10  7  7  8  7  9  6  7  5
## [3865] NA  5  8  5  8  6 10  9  8  5 NA  6  6  9  6  6  6  8  5  7  8  4  5  7
## [3889]  9  9  6  9  7  7  7  6  6  5  8  8  8  5  6  9  7  7  8  7 NA  8  5  9
## [3913]  6  8  7  6 NA  8  7 10  8 NA  9  8  9  6 NA  7  9 10  6  7  8  7  6  6
## [3937]  8  7  7  7  6  7  6  6  5  7  8  9  5  9  7  5  6  4  5 10  6  8  7  7
## [3961]  8  4  9  7  6  8  7  7  8  7  5  8  7  4 NA  6  8  6  5  9  8  7  8  8
## [3985]  5  7  9  7  8  7  9  9  9 10  8  8  6  6  7  5  7  8  5  7  7  7  8  8
## [4009]  9  8  9  7  7  7  9  7  7 10  5  8  7  7  6  6  6  8  8  4  5  8  8  5
## [4033] NA  8  6  5  7  7  7  6 10  6  6  7 NA  8  9  8  4 NA  9  9  8  6  7  6
## [4057]  5 NA 10  6  9  6  5  8  7  9  9  7  9  6  9  5  9  9  6  9  5  6  7  8
## [4081]  5 10  4  7  4  9  6  7  7  5  5  9  7  4  7  4  7  6  7  8  9  5  6  8
## [4105]  7  4  7  9  5  7  4  8  7  6  6  5  9  6  8  6 NA  9 10 10  6  6 10  7
## [4129] NA  6  6  8  4  8  8  6  7  7  7  8  6 10  7  7 10  4 10  7  6  5  6  7
## [4153]  8  7  6  9 10  9  6  8  8 NA  6  6  9  8  5  8 10  6  6  8  9  7  9  6
## [4177]  5  6  5  8  6  7 NA  7  7  9  5  8  8  7  6  5 10  7  7 10  7 10  5 NA
## [4201]  5  7  6  7  6  7  6  9  5  7  5  6  7  7  5  6  5  9  5 10  9  8  7  8
## [4225]  8  9  7  9  7 10  7  5  7  8 NA  4  8  8  5  7  7  8  6  6  5 10  8  6
## [4249]  5  5  7  4  8  8  7  7  8  7  8  5  8  7  9  7  7  6  9  4  8  7  7  7
## [4273]  8  6  7  8  6  8  8  6  5  6  7  7  9  6  6  8  6  6  6  4  8  8 NA 10
## [4297]  9  6  9  7  6  6 NA  7  9 NA  6  5  8  8  9  7  8  8  7  8  8  7 10 10
## [4321]  7  7 NA  7  9  5  7  8  9  5  6  6  5  7 NA  7  5  4  8  6  5  8  6  4
## [4345]  7  9  6  6 10  8 10  7  7  9  7  7 10  7  8  6  8  7  8  7  8  5  9  6
## [4369] NA  6  7  7  8  8  8  8  7  7  8  5  4 NA  7  8  6  9  8 NA  4 NA  9  7
## [4393]  7  7 NA  9  6  8  7  8  6  9  8 NA  5  5 10 NA  6  8  6  4  4  7  9  9
## [4417]  9  8 NA  9  4  8  5  6  8  8  6  8  8  7  7 10  7  7 NA  7  8  9  7  6
## [4441] 10  4 10  9  9  9 10 NA  6  6 NA  6  5  6  7  9 NA  8  5  4 NA  6 NA  6
## [4465]  6  6  5  4  4  7  9  7  7  5  6 NA  4  9  4  7  8  9  6 10  7  7  7 10
## [4489] NA  6  9  8  5  5  7  8  6  4  5  9  8  9  9  6  6  7  8  9 10 NA  8 10
## [4513]  7  9  8 NA  7  5  8  8  6  7  6  6  6  5  6  8  9 10  6  9  8  7  8 NA
## [4537] NA  6  6  6  6  7  7  6 10  6  7  4  7  5  6  4  6 NA  7  6  7  6  7  7
## [4561]  7 NA  8  8  7  7  7  7  7  6  4  7  8  5 NA  8 NA  7  9  9  6  8  6 10
## [4585]  7  5  8  9  9  7  8  6  8  8  5  7  7  7  7  9 NA  4 10  4  8  5  9  7
## [4609]  8  4  8  8  8  8  7  7  6  6 NA  6  4  6  7  8  4  4  7  9  4  8  9 NA
## [4633]  8  7 10  6  7  6  7  7  9  9  8  9  6  6  8  7 10  4  8  6  6  5  9 NA
## [4657]  6  6  5  5  6  9 10  6  6  5  8  8  7  6  9  8  8 NA  7  6  8  8  8  5
## [4681]  8  7  6  8  7  8  7  7  9  5  6  6  7  6  6  7  9 NA  8 NA  6  4  8  8
## [4705]  7  6  6  8  8  8  8  8  8  6  5  7  8  5  7  9 NA  9  7 NA  6  7  5  5
## [4729] NA  7 10  7  7  9  6  4  6  6  4  7  6  5  8  7  7  8  7 NA  6  5  7  6
## [4753]  8  7  8  6  5 10  7  8 NA  7  9  5 10  7  6  6  7  8  7  8  8  7  6  7
## [4777] 10  7  9  6  7 NA NA  5  9 10  6  6  7  6  5  9  6  7  5  8  7  4  9  8
## [4801]  7  7 10  8  7  5  7  8  7  6  6  8  6  4 NA  7  8  8  5  7  6  6  6  7
## [4825] 10  6  7  7  7 NA  7  6  9  5  8  6  4  6  6  5  8  5  6  7  6  6  6  6
## [4849]  8  6  7  9  8  5  8  9  6  5  6  7  8  6  4  5  8 10  7  9  5  6  4  6
## [4873]  8  6 10 10  4  6  8  5  9  9  5  7  7  8  7  8  5  9  9  7 NA NA  7 NA
## [4897]  7  7  5  5 10  7  7  9  8  8  5  7  6  6  7  8  7  9  9  9  7  6  7  9
## [4921]  9  4  7  4  7  6  6  8  6  7  6  7  6  8  7  7  6  8  8  7  7  8  8  7
## [4945]  9  8 10  8  9  9  7  5  9  6  7 10  5  6  6  7  8  8 NA  6  5  6  8  7
## [4969]  4  4  7  8  6  8  5  7  7  8  5  5 NA  5 NA  9 NA  8  8  8  7 10  7  8
## [4993]  6  6  9  6  8  8  7  4  9  6  7  5  6  6  7  6 10  7  8  8  6  6  6  8
## [5017]  8  7  7 10  7  4  8  8  9  8  6 NA  7  9  9 NA  8  9  7 10  9  6  7  8
## [5041] 10  8  7  9  7  6  8  6 10 NA  8  9  7  7  7  5  7  8  5  9  7  7  5  6
## [5065]  5  6  7  8  4  7  7  6  6  9 10  4  6  7  8  7  7  8  8  8  7  7  8  7
## [5089]  8  6  8  9  5  5  8  7 NA  8  6  8  8  6  9  7  5  5  8  5  5  8  5  8
## [5113]  8  4  8  5  6  9  6  7  6  6  5  7  7  8  7 NA  8  6  5  8  6  7  6  6
## [5137]  4  8  4  9  9  6 NA 10  7  7  9  5  7  8  8  7  7  7  8  7  7  6 10  6
## [5161]  8 10  5  8 10  6  6  7  6 10  7  6  6  8  8 NA  5  7  7  6  9  8  7  6
## [5185] 10  5  6  7  8  5  6  8 NA  6  7  6  7  7  9  8  7  7 10  6  7  6  8 10
## [5209]  7  7  7  5  7 10  8  9  9  6 10  4  7  4  4  8  9  4  7  9 10 NA  5  5
## [5233]  7 10  6 NA  5  7 NA  7  8  8  7  7  7  7  6  5  7  6 NA  7  8  5 10  4
## [5257]  9  7  6  5  7  7  9  7  7  8  7  7  7  8  6  6  8  5  7  6  8  9  6  8
## [5281]  7  6  7  9  7  9  7  5  7  7  6 10  9  7  9 NA  5  8  8  6  6  8  4  8
## [5305]  7 NA  8  6  5  9  7  7  8  6  8  8  9  9  7  8 NA  7  7  4  9  8  7  7
## [5329]  6  6  8  5  5  8  7  7  7 10  7  7 10  7 10 NA  5 10  6  8 10  9  6  8
## [5353]  8  6  8  6  7  5 NA  7  5  8  8  8  9  8  7  7 10  8  7  7 NA  5 10  8
## [5377]  5  7  9  6  6 NA  8  6  8 NA  6  7  8  6  8  9  6 10  9  7 NA  6 NA  7
## [5401]  5  4  7  7  6  5  4  6  8  7  8  8  8  5  6 10  4  7  8  4  6 10  7  6
## [5425] NA  6 10  6  6  5  7  7  9 NA  8  7  4  6  6 10  8  7  4  4  8  8  6  7
## [5449]  7  7  6  8  9  6  5  7  8  8  8  8  7  7  8  7  7  7  9  7  6  6  8  6
## [5473]  7 NA  5  5  6  5  8 10  6  6  6  8  8  7  5  6  7  7  7  8  5  7  7  6
## [5497]  6  8  5 10  8  7  7  8  6  6  9  6  7  6  7  8 10  6  5  7  6 NA  8 10
## [5521]  4  7  8  7  7  8  7  8  4  6  6  7  6  8  7  5 NA  8  7 NA  8  6  9  9
## [5545]  4  7  6  7  6  6  8  5  7  5  9  7  8  7  7  7  9  6  4  6  5  8  7  8
## [5569]  7 NA NA  9  7  9  7  7  6  9  6  7  5 NA  9  8 10  7  9  8  7  8  6  4
## [5593]  6  4  4  8  8  8  8  4  9  8  8 10  8  5  8  5  7  7  5  5  7  9  8  8
## [5617]  5  7 10  7  9  9  8  7  6  7  6  7  5 NA  6  6  6  7  4  6  7  8 NA  6
## [5641]  7  8  9 NA  6  6  9  6  5  7  9  6  6  6  8  7  9  5  6  6  7  8  6  6
## [5665]  8  8  4  7  7  6  6  6  4  6  5  7  5  8  5  9  8  5  7  6  8 10  6  7
## [5689]  9  8  9  8  7  7  5  6  6  6  7  7 NA  8  9 NA NA  8  8  8  9  8  9  7
## [5713]  6  9 10  9  7  9  8  5  7  7  9  7  6  8  4  6  8  7  8  7  7  6  8  5
## [5737]  7  9  6  5  4 NA  8  6  5  7  5  9  4  5  7  8  9  8  9  7  6  9  9  8
## [5761] NA  9  8  7  8  8  8  7  6  9  6  7 NA  9  7  9 10  7  8  8  7  8  8 NA
## [5785] 10  7  9  9  4  9  9  7  8  8  9  6  9  5  4  8  9  7  4  5  8  7  9  7
## [5809]  6  7  9  9  7  7  8  6  8  7  7  7 10  6  6  9  8  5  7  8  6  8  7  6
## [5833]  9  9  7  8  9  6  8  6  5  6  5  8  6  5  8  8  7  6  6  9  6  6  8  8
## [5857]  7  9  6  8  9  6  6  7  7  8  7  7  6  7  9  9  4  6  7  7  7  6  6  6
## [5881]  8  8  6  9  8  6  7  8  5  5  8  6  9 10  8  8  5  5  7  5  7  6  7  7
## [5905]  7  6  5  7  4  9  8  6  8  6  7  6  7  5  7  5 10 NA  7  8  5  6  8  7
## [5929]  6  8  7  8  8  6  7  6  8  8  6 NA  9  7  8  7  7  7  6  7  4  6  8  8
## [5953] NA  8  8  7  6  8  7  6  6  7  9  7  7  8  8  7 NA  6  9  6  9  7  7  8
## [5977]  6  8  7  8  6  6  4  6  6  6  7  8  8  8 NA  7  7  8  8  5  7  4  4  6
## [6001]  7  6  4  8  6  8  6  6  8  6  7  7  8  6  8  5  8  8  7 NA  7  8  6  7
## [6025]  8  8 10  7 NA  6  5 NA  6  7  8  6  6  9
czynniki5 <- hotdeck(czynniki4)
miss_var_summary(czynniki5)
## # A tibble: 40 × 3
##    variable                   n_miss pct_miss
##    <chr>                       <int>    <num>
##  1 Hours_Studied                   0        0
##  2 Attendance                      0        0
##  3 Parental_Involvement            0        0
##  4 Access_to_Resources             0        0
##  5 Extracurricular_Activities      0        0
##  6 Sleep_Hours                     0        0
##  7 Previous_Scores                 0        0
##  8 Motivation_Level                0        0
##  9 Internet_Access                 0        0
## 10 Tutoring_Sessions               0        0
## # ℹ 30 more rows

Reguły walidacyjne

rules <- validator(
Hours_Studied >= 0,
Hours_Studied <= 168,
Attendance >= 0, 
Attendance <= 100,
Sleep_Hours >= 0,
Sleep_Hours <= 24, 
Previous_Scores >= 0, 
Previous_Scores <= 100, 
Physical_Activity >= 0,
Physical_Activity <= 168,
Exam_Score >= 0,
Exam_Score <= 100,
Sleep_Hours * 7 + Hours_Studied + Physical_Activity >= 0,
Sleep_Hours * 7 + Hours_Studied + Physical_Activity <= 168
)

wyniki <- confront(czynniki5, rules)
summary(wyniki)
##    name items passes fails nNA error warning
## 1   V01  6038   6038     0   0 FALSE   FALSE
## 2   V02  6038   6038     0   0 FALSE   FALSE
## 3   V03  6038   6038     0   0 FALSE   FALSE
## 4   V04  6038   6038     0   0 FALSE   FALSE
## 5   V05  6038   6038     0   0 FALSE   FALSE
## 6   V06  6038   6038     0   0 FALSE   FALSE
## 7   V07  6038   6038     0   0 FALSE   FALSE
## 8   V08  6038   6038     0   0 FALSE   FALSE
## 9   V09  6038   6038     0   0 FALSE   FALSE
## 10  V10  6038   6038     0   0 FALSE   FALSE
## 11  V11  6038   6038     0   0 FALSE   FALSE
## 12  V12  6038   6037     1   0 FALSE   FALSE
## 13  V13  6038   6038     0   0 FALSE   FALSE
## 14  V14  6038   6038     0   0 FALSE   FALSE
##                                                            expression
## 1                                         Hours_Studied - 0 >= -1e-08
## 2                                        Hours_Studied - 168 <= 1e-08
## 3                                            Attendance - 0 >= -1e-08
## 4                                           Attendance - 100 <= 1e-08
## 5                                           Sleep_Hours - 0 >= -1e-08
## 6                                           Sleep_Hours - 24 <= 1e-08
## 7                                       Previous_Scores - 0 >= -1e-08
## 8                                      Previous_Scores - 100 <= 1e-08
## 9                                     Physical_Activity - 0 >= -1e-08
## 10                                   Physical_Activity - 168 <= 1e-08
## 11                                           Exam_Score - 0 >= -1e-08
## 12                                          Exam_Score - 100 <= 1e-08
## 13  Sleep_Hours * 7 + Hours_Studied + Physical_Activity - 0 >= -1e-08
## 14 Sleep_Hours * 7 + Hours_Studied + Physical_Activity - 168 <= 1e-08
plot(wyniki)

dane_zwalidowane <- czynniki5 %>%
  replace_errors(rules)
errors_removed(dane_zwalidowane)
## call:  locate_errors(data, x, ref, ..., cl = cl, Ncpus = Ncpus) 
## located  1  error(s).
## located  0  missing value(s).
## Use 'summary', 'values', '$errors' or '$weight', to explore and retrieve the errors.
par(mfrow=c(2,3))
boxplot(dane_zwalidowane$Hours_Studied, main="Hours Studied") 
boxplot(dane_zwalidowane$Attendance, main="Attendance")
boxplot(dane_zwalidowane$Sleep_Hours, main="Sllep Hours")
boxplot(dane_zwalidowane$Previous_Scores, main="Previos Scores")
boxplot(dane_zwalidowane$Tutoring_Sessions, main="Tutoring Sessions")
boxplot(dane_zwalidowane$Exam_Score, main="Exam Score")

par(mfrow=c(2,3)) #zmienić przy kolejnych wykresach na c(1,1) bo będzie pamiętać i tworzyć wykresy w blokach 6- wykresowych
boxplot(dane_zwalidowane$Hours_Studied, main="Hours Studied") 
boxplot(dane_zwalidowane$Attendance, main="Attendance")
boxplot(dane_zwalidowane$Sleep_Hours, main="Sllep Hours")
boxplot(dane_zwalidowane$Previous_Scores, main="Previos Scores")
boxplot(dane_zwalidowane$Tutoring_Sessions, main="Tutoring Sessions")
boxplot(dane_zwalidowane$Exam_Score, main="Exam Score")
ggplot(dane_zwalidowane, aes(x=Attendance)) +
  geom_boxplot() +
  theme_bw() +
  coord_flip()

ggplot(dane_zwalidowane, aes(x=Hours_Studied)) +
  geom_boxplot() +
  theme_bw() +
  coord_flip()

ggplot(dane_zwalidowane, aes(x=Sleep_Hours)) +
  geom_boxplot() +
  theme_bw() +
  coord_flip()

ggplot(dane_zwalidowane, aes(x=Previous_Scores)) +
  geom_boxplot() +
  theme_bw() +
  coord_flip()

ggplot(dane_zwalidowane, aes(x=Tutoring_Sessions)) +
  geom_boxplot() +
  theme_bw() +
  coord_flip()

ggplot(dane_zwalidowane, aes(x=Exam_Score)) +
  geom_boxplot() +
  theme_bw() +
  coord_flip()

grubbs.test(dane_zwalidowane$Hours_Studied)
## 
##  Grubbs test for one outlier
## 
## data:  dane_zwalidowane$Hours_Studied
## G = 4.01539, U = 0.99733, p-value = 0.1773
## alternative hypothesis: highest value 44 is an outlier
grubbs.test(dane_zwalidowane$Attendance)
## 
##  Grubbs test for one outlier
## 
## data:  dane_zwalidowane$Attendance
## G = 1.72722, U = 0.99951, p-value = 1
## alternative hypothesis: lowest value 60 is an outlier
grubbs.test(dane_zwalidowane$Sleep_Hours)
## 
##  Grubbs test for one outlier
## 
## data:  dane_zwalidowane$Sleep_Hours
## G = 2.0552, U = 0.9993, p-value = 1
## alternative hypothesis: lowest value 4 is an outlier
grubbs.test(dane_zwalidowane$Previous_Scores)
## 
##  Grubbs test for one outlier
## 
## data:  dane_zwalidowane$Previous_Scores
## G = 1.7435, U = 0.9995, p-value = 1
## alternative hypothesis: lowest value 50 is an outlier
grubbs.test(dane_zwalidowane$Tutoring_Sessions)
## 
##  Grubbs test for one outlier
## 
## data:  dane_zwalidowane$Tutoring_Sessions
## G = 5.25143, U = 0.99543, p-value = 0.0004415
## alternative hypothesis: highest value 8 is an outlier
grubbs.test(dane_zwalidowane$Exam_Score)
## 
##  Grubbs test for one outlier
## 
## data:  dane_zwalidowane$Exam_Score
## G = 8.40582, U = 0.98829, p-value < 2.2e-16
## alternative hypothesis: highest value 100 is an outlier
ggplot(dane_zwalidowane, aes(x = Gender, fill = Gender))+
  geom_bar()+
  scale_fill_manual(values =c("Female"="pink","Male"="lightblue"))+
  theme_minimal()+
  ggtitle("Podział płci w próbie")+
  theme(plot.title = element_text(hjust =0.5))

ggplot(dane_zwalidowane, aes(x = Exam_Score, fill = Exam_Score))+
  geom_histogram(binwidth =5,fill="#5C1C81", color ="black")+
  theme_minimal()+
  ggtitle("Rozkład wyników egzaminów")+
  theme(plot.title = element_text(hjust =0.5))
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_bin()`).

 w1 <- ggplot(dane_zwalidowane, aes(x = Exam_Score))+
  geom_histogram(binwidth =5, fill ="steelblue", color ="black")+
  theme_minimal()+
  labs(title ="Rozkład wyników egzaminów", x ="Wynik egzaminu", y ="Liczba uczniów")+
  facet_grid(~Gender)
w2 <-ggplot(dane_zwalidowane, aes(x = Hours_Studied))+
  geom_histogram(binwidth =5, fill ="darkgreen", color ="black")+
  theme_minimal()+
  labs(title ="Rozkład godzin nauki", x ="Godziny nauki w tygodniu", y="Liczba uczniów")+
  facet_grid(~Gender)
grid.arrange(w1, w2, nrow = 1)
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_bin()`).

ggplot(dane_zwalidowane, aes(x = Hours_Studied, y = Exam_Score))+
  geom_point(color ="blue", alpha =0.6)+
  geom_smooth(method ="lm", color ="red", se =FALSE)+
  theme_minimal()+
  labs(title ="Relacja między godzinami nauki a wynikiem egzaminu",
       x ="Godziny nauki w tygodniu",
       y ="Wynik egzaminu")
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(dane_zwalidowane, aes(x = Parental_Involvement, y = Exam_Score, fill = Parental_Involvement))+
  geom_violin()+
  theme_minimal()+
  labs(title ="Wyniki egzaminów w zależności od zaangażowania rodziców",
       x ="Zaangażowanie rodziców",
       y ="Wynik egzaminu")+
  scale_fill_brewer(palette ="Set2")
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_ydensity()`).

# Wykres słupkowy typów szkół
ggplot(dane_zwalidowane, aes(x = School_Type, fill = School_Type))+
  geom_bar()+
  theme_minimal()+
  labs(title ="Rozkład typów szkół",
       x ="Typ szkoły",
       y ="Liczba uczniów")+
  scale_fill_brewer(palette ="Set1")

ggplot(dane_zwalidowane, aes(x = School_Type, y = Exam_Score, fill = School_Type))+
  geom_boxplot()+
  theme_minimal()+
  labs(title ="Wyniki egzaminów w zależności od typów szkół",
       x ="Typ Szkoły",
       y ="Wynik egzaminu")+
  scale_fill_brewer(palette ="Set2")
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_boxplot()`).

ggplot(dane_zwalidowane, aes(x = Parental_Involvement, y = Exam_Score, fill = Parental_Involvement))+
  geom_boxplot()+
  facet_wrap(~ Motivation_Level)+
  theme_minimal()+
  labs(title ="Wyniki egzaminów w zależności od motywacji i zaangażowania rodziców",
       x ="Zaangażowanie rodziców",
       y ="Wynik egzaminu")+
  scale_fill_brewer(palette ="Set3")
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_boxplot()`).

ggplot(dane_zwalidowane, aes(x = Access_to_Resources, y = Exam_Score, fill = Access_to_Resources))+
  geom_boxplot()+
  facet_wrap(~ Internet_Access)+
  theme_minimal()+
  labs(title ="Wyniki egzaminów w zależności od dostępu do źródeł i internetu",
       x ="Dostęp do źródeł",
       y ="Wynik egzaminu")+
  scale_fill_brewer(palette ="Set5")
## Warning: Unknown palette: "Set5"
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_boxplot()`).

ggplot(dane_zwalidowane, aes(x = Exam_Score))+
  geom_histogram(binwidth =5, fill ="steelblue", color ="black")+
  theme_minimal()+
  labs(title ="Rozkład wyników egzaminów", x ="Wynik egzaminu", y ="Liczba uczniów")+
  facet_grid(~Learning_Disabilities)
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_bin()`).

# Wykres heksagonalny
ggplot(dane_zwalidowane, aes(x = Distance_from_Home, y = Exam_Score)) +
  geom_hex(bins = 30) + # Liczba przedziałów (możesz dostosować np. 20, 40)
  scale_fill_viridis_c() + # Kolorystyka dla lepszej wizualizacji
  theme_minimal() +
  labs(
    title = "Zależność między wynikiem egzaminu a dystansem od domu",
    x = "Dystans od domu do szkoły",
    y = "Wynik Egzaminu",
    fill = "Gęstość"
  )
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_binhex()`).

ld_counts <- dane_zwalidowane %>%
  count(Learning_Disabilities)%>%
  mutate(Percentage =round(n /sum(n)*100,1))# Zaokrąglamy do 1 miejsca po przecinku# Tworzenie wykresu kołowego
ggplot(ld_counts, aes(x ="", y = n, fill = Learning_Disabilities))+
  geom_bar(stat ="identity", width =1)+
  coord_polar("y", start =0)+
  scale_fill_manual(values =c("Yes"="red","No"="lightblue"))+
  theme_void()+
  ggtitle("Udział osób z trudnościami w uczeniu się")+
  theme(plot.title = element_text(hjust =0.5))+
  geom_text(aes(label = paste0(Percentage,"%")), 
            position = position_stack(vjust =0.5), 
            color ="black", size =5)

ggplot(dane_zwalidowane, aes(x = Exam_Score))+
  geom_histogram(binwidth =5, fill ="darkred", color ="black")+
  theme_minimal()+
  labs(title ="Rozkład wyników egzaminów", x ="Wynik egzaminu", y ="Poziom wykształcenia rodziców")+
  facet_grid(~Parental_Education_Level)
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_bin()`).

# Upewniamy się, że kategorie są w poprawnej kolejności
dane_zwalidowane$Teacher_Quality <- factor(dane_zwalidowane$Teacher_Quality, levels =c("Low","Medium","High"))# Obliczenie mediany wyników egzaminów dla każdej kategorii jakości nauczycieli
median_scores <- dane_zwalidowane %>%
  group_by(Teacher_Quality)%>%
  summarise(Median_Exam_Score = median(Exam_Score, na.rm =TRUE))# Wykres liniowy z medianą
ggplot(median_scores, aes(x = Teacher_Quality, y = Median_Exam_Score, group =1))+
  geom_line(color ="#ff6347", size =1)+# Linia wykresu
  geom_point(color ="darkred", size =3)+# Punkty oznaczające medianę
  geom_text(aes(label =round(Median_Exam_Score,1)), vjust =-1)+# Etykiety mediany
  ylim(0,100)+# Skala od 0 do 100
  theme_minimal()+
  ggtitle("Mediana wyniku egzaminu a jakość nauczycieli")+
  xlab("Jakość nauczycieli")+
  ylab("Mediana wyniku egzaminu")+
  theme(plot.title = element_text(hjust =0.5))
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

ggplot(dane_zwalidowane, aes(x = Family_Income, y = Tutoring_Sessions, color = Family_Income)) +
  geom_jitter(width = 0.2, alpha = 0.7) + # Dodanie punktów z małym zakłóceniem na osi X (w celu uniknięcia nakładania punktów)
  geom_smooth(method = "lm", se = FALSE, color = "black") + # Linia trendu (regresji liniowej)
  scale_color_manual(values = c("High" = "lightgreen", "Medium" = "lightblue", "Low" = "lightpink")) +
  theme_minimal() +
  labs(
    title = "Wpływ dochodów rodziny na liczbę korepetycji",
    x = "Dochód rodziny",
    y = "Liczba korepetycji",
    color = "Dochód"
  )
## `geom_smooth()` using formula = 'y ~ x'

ld_counts <- dane_zwalidowane %>%
  count(Family_Income)%>%
  mutate(Percentage =round(n /sum(n)*100,1))# Zaokrąglamy do 1 miejsca po przecinku# Tworzenie wykresu kołowego
ggplot(ld_counts, aes(x ="", y = n, fill = Family_Income))+
  geom_bar(stat ="identity", width =1)+
  coord_polar("y", start =0)+
  scale_fill_manual(values =c("Low"="lightpink","Medium"="lightblue","High"="lightgreen"))+
  theme_void()+
  ggtitle("Poziom dochodów rodziców")+
  theme(plot.title = element_text(hjust =0.5))+
  geom_text(aes(label = paste0(Percentage,"%")), 
            position = position_stack(vjust =0.5), 
            color ="black", size =5)

ggplot(dane_zwalidowane, aes(x = Sleep_Hours, y = Exam_Score)) +
  geom_jitter(color = "purple", alpha = 0.5) +
  geom_smooth(method = "lm", color = "orange", se = TRUE) +
  theme_minimal() +
  labs(title = "Relacja między godzinami snu a wynikiem egzaminu",
       x = "Godziny snu",
       y = "Wynik egzaminu")
## `geom_smooth()` using formula = 'y ~ x'

# Używamy Twojego zbioru danych
zmienne_ilosciowe <- dane_zwalidowane %>%
  select(Hours_Studied, Attendance, Sleep_Hours, Previous_Scores, 
         Tutoring_Sessions, Physical_Activity, Exam_Score)

data <- zmienne_ilosciowe
# Wyliczenie statystyk opisowych dla zmiennej Hours_Studied
stat_desc <- data %>%
  summarise(
    średnia = mean(Hours_Studied, na.rm = TRUE),
    mediana = median(Hours_Studied, na.rm = TRUE),
    odchylenie_standardowe = sd(Hours_Studied, na.rm = TRUE),
    minimum = min(Hours_Studied, na.rm = TRUE),
    maksimum = max(Hours_Studied, na.rm = TRUE)
  ) %>%
  pivot_longer(
    cols = everything(),  # Wszystkie kolumny przekształcamy w długą tabelę
    names_to = "Statystyka",
    values_to = "Wartość"
  ) 
# Tworzenie efektownej tabeli za pomocą gt
stat_desc %>%
  gt() %>%
  tab_header(
    title = "Statystyki Opisowe:",
    subtitle = "Hours_Studied"
  ) %>%
  fmt_number(
    columns = Wartość,
    decimals = 2
  ) %>%
  data_color(
    columns = Wartość,
    colors = scales::col_numeric(
      palette = c("purple", "pink", "lightblue"),
      domain = NULL
    )
  ) %>%
  cols_label(
    Statystyka = "Rodzaj statystyki",
    Wartość = "Wartość"
  ) %>%
  tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_column_labels()
  )
## Warning: Since gt v0.9.0, the `colors` argument has been deprecated.
## • Please use the `fn` argument instead.
## This warning is displayed once every 8 hours.
Statystyki Opisowe:
Hours_Studied
Rodzaj statystyki Wartość
średnia 19.99
mediana 20.00
odchylenie_standardowe 5.98
minimum 1.00
maksimum 44.00
# Używamy Twojego zbioru danych
zmienne_ilosciowe <- dane_zwalidowane %>%
  select(Hours_Studied, Attendance, Sleep_Hours, Previous_Scores, 
         Tutoring_Sessions, Physical_Activity, Exam_Score)

data <- zmienne_ilosciowe
# Wyliczenie statystyk opisowych dla zmiennej Attendance
stat_desc <- data %>%
  summarise(
    średnia = mean(Attendance, na.rm = TRUE),
    mediana = median(Attendance, na.rm = TRUE),
    odchylenie_standardowe = sd(Attendance, na.rm = TRUE),
    minimum = min(Attendance, na.rm = TRUE),
    maksimum = max(Attendance, na.rm = TRUE)
  ) %>%
  pivot_longer(
    cols = everything(),  # Wszystkie kolumny przekształcamy w długą tabelę
    names_to = "Statystyka",
    values_to = "Wartość"
  ) 

# Tworzenie efektownej tabeli za pomocą gt
stat_desc %>%
  gt() %>%
  tab_header(
    title = "Statystyki Opisowe:",
    subtitle = "Attendance"
  ) %>%
  fmt_number(
    columns = Wartość,
    decimals = 2
  ) %>%
  data_color(
    columns = Wartość,
    colors = scales::col_numeric(
      palette = c("purple", "pink", "lightblue"),
      domain = NULL
    )
  ) %>%
  cols_label(
    Statystyka = "Rodzaj statystyki",
    Wartość = "Wartość"
  ) %>%
  tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_column_labels()
  )
Statystyki Opisowe:
Attendance
Rodzaj statystyki Wartość
średnia 80.02
mediana 80.00
odchylenie_standardowe 11.59
minimum 60.00
maksimum 100.00
# Używamy Twojego zbioru danych
zmienne_ilosciowe <- dane_zwalidowane %>%
  select(Hours_Studied, Attendance, Sleep_Hours, Previous_Scores, 
         Tutoring_Sessions, Physical_Activity, Exam_Score)

data <- zmienne_ilosciowe
# Wyliczenie statystyk opisowych dla zmiennej Sleep_Hours
stat_desc <- data %>%
  summarise(
    średnia = mean(Sleep_Hours, na.rm = TRUE),
    mediana = median(Sleep_Hours, na.rm = TRUE),
    odchylenie_standardowe = sd(Sleep_Hours, na.rm = TRUE),
    minimum = min(Sleep_Hours, na.rm = TRUE),
    maksimum = max(Sleep_Hours, na.rm = TRUE)
  ) %>%
  pivot_longer(
    cols = everything(),  # Wszystkie kolumny przekształcamy w długą tabelę
    names_to = "Statystyka",
    values_to = "Wartość"
  ) 
# Tworzenie efektownej tabeli za pomocą gt
stat_desc %>%
  gt() %>%
  tab_header(
    title = "Statystyki Opisowe:",
    subtitle = "Sleep_Hours"
  ) %>%
  fmt_number(
    columns = Wartość,
    decimals = 2
  ) %>%
  data_color(
    columns = Wartość,
    colors = scales::col_numeric(
      palette = c("purple", "pink", "lightblue"),
      domain = NULL
    )
  ) %>%
  cols_label(
    Statystyka = "Rodzaj statystyki",
    Wartość = "Wartość"
  ) %>%
  tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_column_labels()
  )
Statystyki Opisowe:
Sleep_Hours
Rodzaj statystyki Wartość
średnia 7.03
mediana 7.00
odchylenie_standardowe 1.48
minimum 4.00
maksimum 10.00
# Używamy Twojego zbioru danych
zmienne_ilosciowe <- dane_zwalidowane %>%
  select(Hours_Studied, Attendance, Sleep_Hours, Previous_Scores, 
         Tutoring_Sessions, Physical_Activity, Exam_Score)

data <- zmienne_ilosciowe
# Wyliczenie statystyk opisowych dla zmiennej Tutoring_Sessions
stat_desc <- data %>%
  summarise(
    średnia = mean(Tutoring_Sessions, na.rm = TRUE),
    mediana = median(Tutoring_Sessions, na.rm = TRUE),
    odchylenie_standardowe = sd(Tutoring_Sessions, na.rm = TRUE),
    minimum = min(Tutoring_Sessions, na.rm = TRUE),
    maksimum = max(Tutoring_Sessions, na.rm = TRUE)
  ) %>%
  pivot_longer(
    cols = everything(),  # Wszystkie kolumny przekształcamy w długą tabelę
    names_to = "Statystyka",
    values_to = "Wartość"
  ) 
# Tworzenie efektownej tabeli za pomocą gt
stat_desc %>%
  gt() %>%
  tab_header(
    title = "Statystyki Opisowe:",
    subtitle = "Tutoring_Sessions"
  ) %>%
  fmt_number(
    columns = Wartość,
    decimals = 2
  ) %>%
  data_color(
    columns = Wartość,
    colors = scales::col_numeric(
      palette = c("purple", "pink", "lightblue"),
      domain = NULL
    )
  ) %>%
  cols_label(
    Statystyka = "Rodzaj statystyki",
    Wartość = "Wartość"
  ) %>%
  tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_column_labels()
  )
Statystyki Opisowe:
Tutoring_Sessions
Rodzaj statystyki Wartość
średnia 1.50
mediana 1.00
odchylenie_standardowe 1.24
minimum 0.00
maksimum 8.00
# Używamy Twojego zbioru danych
zmienne_ilosciowe <- dane_zwalidowane %>%
  select(Hours_Studied, Attendance, Sleep_Hours, Previous_Scores, 
         Tutoring_Sessions, Physical_Activity, Exam_Score)

data <- zmienne_ilosciowe
# Wyliczenie statystyk opisowych dla zmiennej Physical_Activity
stat_desc <- data %>%
  summarise(
    średnia = mean(Physical_Activity, na.rm = TRUE),
    mediana = median(Physical_Activity, na.rm = TRUE),
    odchylenie_standardowe = sd(Physical_Activity, na.rm = TRUE),
    minimum = min(Physical_Activity, na.rm = TRUE),
    maksimum = max(Physical_Activity, na.rm = TRUE)
  ) %>%
  pivot_longer(
    cols = everything(),  # Wszystkie kolumny przekształcamy w długą tabelę
    names_to = "Statystyka",
    values_to = "Wartość"
  ) 

# Tworzenie efektownej tabeli za pomocą gt
stat_desc %>%
  gt() %>%
  tab_header(
    title = "Statystyki Opisowe:",
    subtitle = "Physical_Activity"
  ) %>%
  fmt_number(
    columns = Wartość,
    decimals = 2
  ) %>%
  data_color(
    columns = Wartość,
    colors = scales::col_numeric(
      palette = c("purple", "pink", "lightblue"),
      domain = NULL
    )
  ) %>%
  cols_label(
    Statystyka = "Rodzaj statystyki",
    Wartość = "Wartość"
  ) %>%
  tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_column_labels()
  )
Statystyki Opisowe:
Physical_Activity
Rodzaj statystyki Wartość
średnia 2.97
mediana 3.00
odchylenie_standardowe 1.03
minimum 0.00
maksimum 6.00
# Używamy Twojego zbioru danych
zmienne_ilosciowe <- dane_zwalidowane %>%
  select(Hours_Studied, Attendance, Sleep_Hours, Previous_Scores, 
         Tutoring_Sessions, Physical_Activity, Exam_Score)

data <- zmienne_ilosciowe
# Wyliczenie statystyk opisowych dla zmiennej PExam_Score
stat_desc <- data %>%
  summarise(
    średnia = mean(Exam_Score, na.rm = TRUE),
    mediana = median(Exam_Score, na.rm = TRUE),
    odchylenie_standardowe = sd(Exam_Score, na.rm = TRUE),
    minimum = min(Exam_Score, na.rm = TRUE),
    maksimum = max(Exam_Score, na.rm = TRUE)
  ) %>%
  pivot_longer(
    cols = everything(),  # Wszystkie kolumny przekształcamy w długą tabelę
    names_to = "Statystyka",
    values_to = "Wartość"
  ) 

# Tworzenie efektownej tabeli za pomocą gt
stat_desc %>%
  gt() %>%
  tab_header(
    title = "Statystyki Opisowe:",
    subtitle = "Exam_Score"
  ) %>%
  fmt_number(
    columns = Wartość,
    decimals = 2
  ) %>%
  data_color(
    columns = Wartość,
    colors = scales::col_numeric(
      palette = c("purple", "pink", "lightblue"),
      domain = NULL
    )
  ) %>%
  cols_label(
    Statystyka = "Rodzaj statystyki",
    Wartość = "Wartość"
  ) %>%
  tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_column_labels()
  )
Statystyki Opisowe:
Exam_Score
Rodzaj statystyki Wartość
średnia 67.25
mediana 67.00
odchylenie_standardowe 3.90
minimum 56.00
maksimum 100.00
# Statystyki opisowe dla zmiennych ilościowych
zmienne_ilosciowe <- dane_zwalidowane %>%
  select(Hours_Studied, Attendance, Sleep_Hours, Previous_Scores, 
         Tutoring_Sessions, Physical_Activity, Exam_Score)


 
#. Macierz korelacji dla zmiennych ilościowych
macierz_korelacji <- cor(zmienne_ilosciowe, use = "complete.obs")
print(macierz_korelacji)
##                   Hours_Studied   Attendance  Sleep_Hours Previous_Scores
## Hours_Studied       1.000000000 -0.001527627  0.014801867     0.017698977
## Attendance         -0.001527627  1.000000000 -0.021754266    -0.016306714
## Sleep_Hours         0.014801867 -0.021754266  1.000000000    -0.019589068
## Previous_Scores     0.017698977 -0.016306714 -0.019589068     1.000000000
## Tutoring_Sessions  -0.013941975  0.014743286 -0.007150278    -0.020365357
## Physical_Activity   0.005044221 -0.018809595 -0.005467017    -0.005460835
## Exam_Score          0.418862859  0.553354853 -0.016444605     0.164453099
##                   Tutoring_Sessions Physical_Activity  Exam_Score
## Hours_Studied          -0.013941975       0.005044221  0.41886286
## Attendance              0.014743286      -0.018809595  0.55335485
## Sleep_Hours            -0.007150278      -0.005467017 -0.01644460
## Previous_Scores        -0.020365357      -0.005460835  0.16445310
## Tutoring_Sessions       1.000000000       0.015166600  0.13953924
## Physical_Activity       0.015166600       1.000000000  0.03247969
## Exam_Score              0.139539241       0.032479693  1.00000000
# Wizualizacja macierzy korelacji
corrplot(macierz_korelacji, method = "circle", type = "upper", 
         tl.col = "black", tl.srt = 45, col = colorRampPalette(c("blue", "white", "red"))(200))